- Since:
-
9.4.0
Examples
Configuration of a button to toggle the "altdays" banding scheme (where `qc` is the CompactChart instance):
buttons: {
...
types: {
...
stripe: {
label: "|x| |",
reader: "Striping",
group: "settings",
toggles: "altdays",
action: function(qc) {
const { toggles } = qc.banding;
toggles[this.toggles] = !toggles[this.toggles];
this.toggleActive(toggles[this.toggles]);
qc.draw();
},
isActive: function(qc) { return !!qc.banding.toggles[this.toggles]; }
},
...
},
...
}
Toggle banding on and off via API function call (where `qc` is the CompactChart instance):
qc.banding.toggles.altdays = true | false;
Members
-
toggles
-
State of each banding type (true = on). {Record<string, boolean>}
- Since:
-
10.1.0
Type Definitions
-
BandingConfig
-
Configure the banding module.
Type:
- Since:
-
- 9.4.0 Introduced
- 10.1.0 Added other banding types.
Properties:
Name Type Argument Description extendedHoursBandingSegment <optional>
Banding type reserved for extended hours configuration.
*BandingSegment <optional>
Any other banding types.
-
BandingFunction(record)
-
Function that processes a data record and returns a "session". A "session" is just a name of a property which is set up in the BandingSegment. The property's values include the
backgroundColorproperty, which defines the color of the band for this record.Parameters:
Name Type Description recordDataRecord A quote record to examine. A DataRecord is an internal object which represents data for a specific time.
- Since:
-
10.1.0
Returns:
Name of a "session" to which this record belongs.
- Type
- string
-
BandingSegment
-
Defines how the banding will work for this particular banding type. This can be set up in the
bandingsection of the themes modules for each theme, so custom colors can be set.Type:
- object
- Since:
-
9.4.0
Properties:
Name Type Argument Description processFnBandingFunction <optional>
Function that determines what band "session" to use. This function is not required for extendedHours band type.
dividerobject <optional>
Line treatment to use for vertical lines dividing the bands.
Properties
Name Type Argument Description colorstring <optional>
Color of line.
widthstring <optional>
Width of line, include "px": e.g. 1px.
patternstring <optional>
Pattern of line, "dashed", "dotted", "solid".
_session_Record.<string, object> <optional>
Band "session" and background color for it.
Example
Configuration for a banding type called "altdays" that shades odd days on the chart:
banding: { modulePath: "./modules/banding.js", altdays: { processFn: (record) => (record.dT.getDate() % 2 ? "odd" : "even"), odd: { backgroundColor: "grey" } } }
