- Since:
-
9.4.0
Members
-
<constant> BLACK :string
-
The web color "black".
Type:
- string
- Since:
-
9.4.0
-
<constant> FADED_BLACK :string
-
The web color "black", at 60% opacity.
Type:
- string
- Since:
-
9.4.0
-
<constant> FADED_GRAY :string
-
The web color "gray", at 80% opacity.
Type:
- string
- Since:
-
9.4.0
-
<constant> FADED_LIGHTGRAY :string
-
The web color "lightgray", at 80% opacity.
Type:
- string
- Since:
-
9.4.0
-
<constant> GRAY :string
-
The web color "gray".
Type:
- string
- Since:
-
9.4.0
-
<constant> LIGHTGRAY :string
-
The web color "lightgray".
Type:
- string
- Since:
-
9.4.0
-
<constant> WHITE :string
-
The web color "white".
Type:
- string
- Since:
-
9.4.0
-
<constant, nullable> ownerWindow :Window
-
Accesses the defaultView of the chart container.
Type:
- Window
- Since:
-
9.4.0
-
banding :Banding
-
Object representing banding instance.
Type:
-
<readonly> buttons :Record.<string, Button>
-
Object containing current menu buttons.
Type:
- Record.<string, Button>
- Since:
-
9.4.0
-
<readonly> chart :Chart
-
Object representing the chart and its components (panels, axes, etc) as well as the dataSet, dataSegment, and other relevant data. There are many properties within the chart object that can be accessed; however, they are not yet documented here.
Type:
- Since:
-
9.4.0
-
config :Config
-
The live configuration of the instance, which includes any changes since the initial creation, merged with the current theme properties.
Type:
- Since:
-
9.4.0
-
<readonly> container :CompactChartContainer
-
The chart container element.
Type:
- Since:
-
9.4.0
-
layout :Layout
-
Object reflecting state of chart layout.
Type:
- Since:
-
9.4.0
-
masterData :Array.<MasterRecord>
-
List of data points loaded into the chart. The data includes a date (
dT) as well as an object for each symbol. These symbol objects contain the data fields for that symbol.Type:
- Array.<MasterRecord>
- Since:
-
9.4.0
-
Object containing current state of menu buttons.
Type:
- Since:
-
9.4.0
-
<readonly> modules :Modules
-
Object containing module names and modules of what has been loaded into the chart. The type of "Modules" represents any class or object successfully imported through a
modulePathorclassDefinitionproperty.Type:
- Modules
- Since:
-
9.4.0
-
<readonly> originalConfig :Config
-
The configuration as passed to the create method when chart was initialized.
Type:
- Since:
-
- 9.4.0 Introduced as
initialConfig - 10.1.0 Renamed to
originalConfig
- 9.4.0 Introduced as
-
preferences :Preferences
-
Object reflecting state of chart preferences.
Type:
- Since:
-
9.4.0
-
<readonly> renderers :Array.<Renderer>
-
List of renderers in use on the chart.
Type:
- Array.<Renderer>
- Since:
-
9.4.0
-
<readonly> series :Array.<Series>
-
List of series in use on the chart. Each series is an object consisting of the
symboland themarketfor that symbol.Type:
- Array.<Series>
- Since:
-
9.4.0
-
<readonly> studies :Array.<StudyDescriptor>
-
List of study descriptors in use on the chart. A StudyDescriptor is an object that contains study settings and current state.
Type:
- Array.<StudyDescriptor>
- Since:
-
9.4.0
Methods
-
addCallbackListener(type, cb)
-
Adds a listener
cbto be fired when an event of typetypeis dispatched.Parameters:
Name Type Description typestring One of the following events:
dataSet- dataSet is builtdestroy- instance destroy method is calleddraw- canvas is paintedlayout- layout change is advertisednewChart- initial data loaded from quotefeedperiodicity- periodicity changespreferences- preferences change is advertisedsymbol- symbol is added or removed from masterDatatheme- theme is changed
cbCallbackFunction Listener function that takes a
dataobject argument which contains at least the CompactChart instance qc, as well as possible other properties.- Since:
-
9.4.0
Returns:
An object containing the type and the callback, in case these need to be used to remove the listener in the future.
- Type
- object
Example
Add an event listener when chart is destroyed to remove the menus
cc.addCallbackListener("destroy", (data) => { delete data.qc.menus; }); -
<async> addData(symbol [, params])
-
Adds market data to the chart, to be stored in
masterData.Parameters:
Name Type Argument Description symbolstring Symbol for which the data is being added.
paramsDataParameters <optional>
Data parameters
- Since:
-
9.4.0
Examples
Add static data for IBM:
cc.addData("IBM", { data: [...], tryQuoteFeed: false }).then(() => { // do something... });You can hook into the addData method by writing and adding a callbackListener for the "symbol" type:
cc.addCallbackListener("symbol", (data) => { if (data.action === "add") console.log("adding data..."); }); -
<async> addEvents(symbol [, params])
-
Adds event data to the chart. The data is used to create markers that appear on the chart representing the event.
Parameters:
Name Type Argument Description symbolstring Symbol for which the data is being added.
paramsEventParameters <optional>
Event parameters
- Since:
-
9.4.0
Example
Add static events for IBM:
cc.addEvents("IBM", { data: [...], tryQuoteFeed: false }).then(() => { // do something... }); -
<async> addRenderer(chartType [, plotHandle] [, params])
-
Adds a renderer to the chart for a particular symbol. A renderer defines how the plot will be rendered. Params can be anything a particular renderer can use to customize the renderer. One popular example is setting the color. Chart types supported are line, mountain, step, scatterplot, candle, hollow_candle, bar, colored_bar, vertex_line, baseline, and histogram. However, in order to add a renderer, the class that supports the renderer must be configured in the CompactChart Config.
Parameters:
Name Type Argument Default Description chartTypestring Type of renderer.
plotHandlestring <optional>
Symbol for which the data is being added. If not supplied, renderer will be applied to default symbol.
paramsRendererParameters <optional>
{} Rendering parameters
- Since:
-
9.4.0
Example
Add an orange step renderer for IBM:
cc.addRenderer("step", "IBM", { fillStyle: "orange" }).then(() => { // do something... }); -
<async> addStudies(types [, symbol])
-
Adds a study or group of studies to the chart for a particular symbol. The study types and their supporting classes must be specified in the CompactChart Config.
Parameters:
Name Type Argument Description typesstring | Array.<string> Study type(s).
symbolstring <optional>
Symbol for which the study is being added. If not supplied, renderer will be applied to default symbol.
- Since:
-
9.4.0
Example
Add some studies for IBM:
cc.addStudies(["maCross", "boll"], "IBM")).then(() => { // do something... }); -
dataCallback()
-
Function that will be called upon completion of data loading. The function takes no arguments. Normally this function does not exist but you can create one if desired.
- Since:
-
9.4.0
Example
A sample function:
cc.dataCallback = () => console.log("data loaded"); -
destroy()
-
Destroys the CompactChart instance. It will restore the DOM back to what it was before the instance was created and make the instance inaccessible for further interaction. You can hook into the destroy method by writing an adding a callbackListener for the "destroy" type.
- Since:
-
9.4.0
Examples
Destroy CompactChart instance:
cc.destroy(); cc = null;You can hook into the destroy method by writing and adding a callbackListener for the "destroy" type:
cc.addCallbackListener("destroy", () => { console.log("chart destroyed."); }); -
draw( [noCheckLoadMore])
-
Forces a re-rendering of the entire chart canvas and any related DOM. You can hook into the draw method by writing an adding a callbackListener for the "draw" type.
Parameters:
Name Type Argument Description noCheckLoadMoreboolean <optional>
Set to true to prevent the function from checking the quote feed for additional historical data to be used to fill the chart.
- Since:
-
9.4.0
Examples
Draw:
cc.draw();You can hook into the draw method by writing and adding a callbackListener for the "draw" type:
cc.addCallbackListener("draw", () => { console.log("chart drawn."); }); -
drawWithRange( [forceLoad])
-
Forces a re-rendering of the entire chart canvas and any related DOM, taking into account any existing span setting in the layout.
Parameters:
Name Type Argument Description forceLoadboolean <optional>
Set to true to cause a refetch of the span data even though the data already exists in masterData.
- Since:
-
- 9.4.0 Introduced
- 10.1.0 added
forceLoadparameter.
-
home( [params])
-
Forces a re-rendering of the chart at the current price's position.
Parameters:
Name Type Argument Description paramsobject <optional>
Parameters for homing.
Properties
Name Type Argument Default Description animateboolean <optional>
Set to true to show an easing effect when chart is drawn, as if the chart is scrolling.
maintainWhitespaceboolean <optional>
true Set to false to disregard any existing "whitespace" padding on the right of the chart
whitespacenumber <optional>
Number of pixels to pad the chart on the right between the most current data point and the y-axis or right side of chart. If not specified, will fall back on chart object's whitespace setting.
- Since:
-
9.4.0
Example
Home the chart with easing effect:
cc.home({ animate: true}); -
<async> loadPlugin(type [, state])
-
Loads a plugin module from the configuration. This is useful if the interaction module is not configured. Possible plugins to load include "crosshair", "headsUp", "easeMachine", "tooltip" or "buttons".
Parameters:
Name Type Argument Description typestring Plugin type as described above.
stateState <optional>
Interaction state, if plugin needs it.
- Since:
-
- 9.4.0 Introduced
- 10.1.0 Added
stateparameter.
Returns:
Plugin module that was loaded.
- Type
- object | undefined
Example
Load the crosshair plugin:
cc.loadPlugin("crosshair", cc.interactionState).then((module) => if (module) ... // module is loaded ) -
notify(error)
-
Places a message
erroronto the chart in a dedicated Element, positionable via stylesheet. Message will remain until notify is called again with a falsey error.Parameters:
Name Type Description errorstring Error message to display.
- Since:
-
9.4.0
-
<async> removeAllData()
-
Removes all data from masterData. Note this does not remove renderers.
- Since:
-
9.4.0
-
<async> removeData(symbol)
-
Removes data for
symbolfrom masterData. Note this does not remove renderer.Parameters:
Name Type Description symbolstring Symbol for which market data is to be removed.
- Since:
-
9.4.0
-
removeEvents(symbol)
-
Removes event markers for symbol
symbol.Parameters:
Name Type Description symbolstring Symbol for which event data is to be removed.
- Since:
-
9.4.0
-
removeRenderer(id [, params])
-
Removes a renderer specified by
id.Parameters:
Name Type Argument Default Description idstring Symbol used to create the renderer.
paramsobject <optional>
{} Removal parameters.
Properties
Name Type Argument Description modifyingboolean <optional>
Set to true if the removal is called from a modify operation.
- Since:
-
9.4.0
-
removeStudies(types)
-
Removes studies whose library names are included in the array
types.Parameters:
Name Type Description typesstring | Array.<string> Study type(s) to remove.
- Since:
-
9.4.0
-
resizeChart( [maintainScroll])
-
Redraws the chart, resizing the dimensions to fit the container's dimensions.
Parameters:
Name Type Argument Description maintainScrollboolean <optional>
Set to true to make the chart's left data position remain after resizing.
- Since:
-
9.4.0
-
restyle()
-
Force a theme refresh.
- Since:
-
9.4.0
-
setDefaultSymbol( [symbol])
-
Make
symbolthe main symbol, which responds to layout changes such as chart type. Note a chart does not have to have a default symbol; if none is specified, it is the earliest symbol added.Parameters:
Name Type Argument Description symbolstring <optional>
If specified, the symbol that should become the main symbol.
- Since:
-
9.4.0
-
setLocale( [locale])
-
Sets the chart's locale to the code
locale. If a language for that locale is included in the configuration, the language of the chart will change as well.Parameters:
Name Type Argument Description localestring <optional>
If specified, the new locale for the chart.
- Since:
-
9.4.0
-
<async> setPeriodicity(periodicity [, force])
-
Changes the periodicity of the chart. This function automatically determines if it has the data already fetched to display the requested periodicity. If it does not, it will fetch it. Use the
forceparameter to always fetch fresh data.Parameters:
Name Type Argument Description periodicityPeriodicity Chart periodicity.
forceboolean <optional>
Set to true to force data load.
- Since:
-
9.4.0
-
setTheme( [themeName])
-
Sets the theme to the one matching the name
themeName. If not found, falls back on hardcoded grayscale theme.Parameters:
Name Type Argument Default Description themeNamestring <optional>
"" Theme name representing new them to load. This name must be present in the configuration.
- Since:
-
9.4.0
-
setTimeZone( [dataZone] [, displayZone])
-
Sets either the dataZone, displayZone, or both to the zone provided. Zones are IANA timezone strings, e.g. "America/Chicago". Note that for either of the two parameters, a value of
nullmeans to use the local timezone. If you do not want to set/change one of these time zones, pass anundefinedas your argument.Parameters:
Name Type Argument Description dataZonestring <optional>
<nullable>
Time zone to use for the market data.
displayZonestring <optional>
<nullable>
Time zone to use for the display on the chart.
- Since:
-
9.4.0
-
tableize( [all])
-
Returns the data available on the chart in tabular format.
Parameters:
Name Type Argument Description allboolean <optional>
Normally only data visible on chart is returned. Set to true to specify all data in memory, even if not displayed in the current chart.
- Since:
-
10.1.0
Returns:
Data records.
- Type
- Array.<Record.<string, (string|number)>>
Example
Output data:
console.table(cc.tableize()); -
<static> create(config)
-
Creates a new CompactChart instance from a configuration object. This is the recommended way to create a CompactChart instance.
Parameters:
Name Type Description configConfig CompactChart configuration object.
- Since:
-
9.4.0
Returns:
A new CompactChart instance.
- Type
- CompactChart
Example
Create a new CompactChart instance with static data for GOOG as a baseline chart:
import sample5min from "./examples/data/GOOG_5MIN.js"; import getLicenseKey from "./key.js"; import { CompactChart } from "./js/compactChart.js"; import { Baseline } from "./js/modules/renderers/baseline.js"; const config = { container: document.getElementById("chartiq_compactchart"), // make sure such an element is on the document initialization: { symbols: [{ symbol: "GOOG", data: sample5min }], renderers: [["baseline", "GOOG"]] }, layout: { interval: "day", period: 1 }, meta: { keyFn: getLicenseKey }, renderers: { Baseline: { classDefinition: Baseline, width: "2px", down: { baseColor: "#B82C0C1F", color: "#B82C0C9F", borderColor: "#B82C0CFF" }, up: { baseColor: "#8CC1761F", color: "#8CC1769F", borderColor: "#8CC176FF" } } }, stylesheets: ["css/styles.css"] }; let cc = CompactChart.create(config);
Type Definitions
-
ChartDescriptor
-
Object that contains the current state of the chart.
Type:
- object
- Since:
-
9.4.0
Properties:
Name Type Argument Description periodicitystring Resolved periodicity as a string.
typestring Chart type.
starttimestring <optional>
Time of first bar visible on chart.
endtimestring <optional>
Time of last bar visible on chart.
ListArray.<string> of symbols on chart.
studieslistArray.<string> List of studies on chart.
-
ChartType
-
Built-in chart types supported.
Type:
- 'bar' | 'baseline' | 'candle' | 'colored_bar' | 'histogram' | 'hollow_candle' | 'line' | 'mountain' | 'scatterplot' | 'step' | 'vertex_line'
- Since:
-
9.4.0
-
CommonModuleConfig
-
Fields common to all module configurations. This tells the CompactChart where to find a module. CompactChart supports both static (classDefinition) and dynamic (modulePath) loading of modules. Providing a
classDefinitionwill take preference over providingmodulePath. Generally, one or the other is required. Default modulePaths are built in and can be found in defaultDynamicModulePaths module. You only need to be concerned about these fields if you want to create your own implementation of a module, or want to load statically.This is a template type definition. The template type, T, denotes the module file's export.
Type:
- object
- Since:
-
9.4.0
Properties:
Name Type Argument Description modulePathstring <optional>
Path to module file to dynamically load.
classDefinitionClass.<T> <optional>
Definition of the class, if you've already statically loaded it.
Example
Static loading:
import { Banding } from "./module/banding.js"; const config: { banding: { classDefinition: Banding; ... }, ... }; -
CompactChartContainer
-
Decorated container element.
Type:
- HTMLElement
- Since:
-
9.4.0
Properties:
Name Type Description qcCompactChart CompactChart instance to which element is attached.
-
Config
-
Combined configuration object used to create the CompactChart. A sample configuration, used in the sample template included in your package, can be found at
examples/config.js. It contains most of the options detailed below. If a particular feature is not desired, it can (and should) be removed from the configuration. Sometimes the mere presence of a configuration property is indication that it should be used. CompactChart combines the configuration file with the chosen theme to comprise a full initialization configuration. If a feature is not desired, be sure to remove it from not only the configuration file but from the theme files as well.Type:
- object
- Since:
-
- 9.4.0 Introduced
- 9.8.0 TooltipConfig added
Properties:
Name Type Argument Description themeNamestring <optional>
Current theme name.
containerHTMLElement DOM element which will contain the compact chart HTML markup. This is a mandatory property as the CompactChart needs to create itself somewhere. You should place an HTMLElement on your template where you want the chart to appear. Set the dimensions of the element as you like. There are a few style settings relating to the class "chart-container" in the application stylesheet.
bandingBandingConfig <optional>
Configuration of banding module.
buttonsButtonsConfig <optional>
UI menu buttons configuration.
chartChartConfig <optional>
General chart configuration.
crosshairCrosshairConfig <optional>
UI crosshair configuration.
easeMachineEaseMachineConfig <optional>
Configure the implementation of chart zoom action.
eventMarkersEventMarkersConfig <optional>
Event markers configuration.
footerFooterConfig <optional>
UI footer menu configuration.
headsUpHeadsUpConfig <optional>
UI heads-up configuration.
initializationInitialConfig <optional>
Initial chart state configuration (data, renderers, studies, events).
interactionInteractionConfig <optional>
Configuration related to chart interaction.
languageLanguageConfig <optional>
Configure language support.
layoutLayoutConfig <optional>
Layout configuration.
markerMarkerConfig <optional>
Markers configuration.
marketMarketConfig <optional>
Support for market time zones.
metaMetaConfig <optional>
High-level configuration.
panelPanelConfig <optional>
Configuration related to a panel.
plotDecoratorsPlotDecoratorConfig <optional>
Configuration for plot decorators (fill-ins).
preferencesPreferences <optional>
Chart preferences.
renderersRendererConfig Configure renderers for different plot types.
quoteDriverQuoteDriverConfig <optional>
Configure quote feeds.
signaliqSignalIQConfig <optional>
Configuration for SignalIQ module.
spanSpanConfig <optional>
Span/Range selection configuration.
studiesStudyConfig <optional>
Studies configuration.
stylesheetsArray.<string> <optional>
List of stylesheet URLs, or inline styles. CompactChart creates a shadow DOM underneath the container. As a result, it is shielded from the page stylesheets. The stylesheets section allows stylesheets to be loaded within the shadow DOM. The stylesheets property is either an array of paths, relative to the html page loading the CompactChart, of stylesheets to load into the container, or actual inline stylesheets which will be added in an inline style tag to the container. In order to load as an inline style, the array element must begin with the string "inline:". The application comes with three stylesheets; you can supplement with your own if you wish.
themesThemesConfig <optional>
Supported themes.
timezoneSupportTimezoneConfig <optional>
Timezone configuration.
tooltipTooltipConfig <optional>
UI tooltip configuration.
xaxisXAxisConfig <optional>
Configuration of x axis.
yaxisYAxisConfig <optional>
Configuration of y axes.
Examples
Creating an HTMLElement in your DOM tree as HTML on your template:
<div id="chartiq_compactchart" class="chart-container" style="height: 300px; width: 100%;"></div>Set your container property then as follows:
container: document.getElementById("chartiq_compactchart") -
DataParameters
-
Parameters passed to CompactChart#addData function.
Type:
- object
- Since:
-
9.4.0
Properties:
Name Type Argument Description dataArray.<PriceRecord> <optional>
Static data to be added, in proper market data format.
appendingboolean <optional>
If true, indicate data is supplementing end of existing data.
appendToDateDate <optional>
Date to truncate existing data to so new data can be added from that date onward.
tryQuoteFeedboolean <optional>
If false, bypass any attempt at supplementing data from quotefeed.
-
InitialConfig
-
This is the section that contains the instructions for what you want the chart to load initially. Renderers, Studies and Events can be added or removed after initialization as well, using the CompactChart class methods.
Type:
- object
- Since:
-
9.4.0
Properties:
Name Type Argument Description symbolsArray.<object> <optional>
List of symbols, with their parameters.
Properties
Name Type Argument Description symbolArray.<object> Ticker symbol or handle.
dataArray.<PriceRecord> <optional>
Optional static data. For examples, see
examples/data/*_DAILY.js.mainboolean <optional>
Indicates whether this is the main series.
bypassQuoteFeedboolean <optional>
Set to true to not attempt to use a quotefeed, even if one is configured.
eventsArray.<object> <optional>
List of events, with their parameters.
Properties
Name Type Argument Description symbolArray.<object> Ticker symbol or handle.
dataArray.<EventRecord> <optional>
Data to be loaded, if statically loading event data.
paramsArray.<EventParameters> <optional>
Optional event parameters. The
params.colorcan be either a literal CSS color, or a variable beginning with an asterisk (*), which matches up to the corresponding variable (eventMarkers.colorMap) in the themes. That way, colors can be customized by theme.renderersArray.<Array> <optional>
List of renderers in the form of an array.
Elements
Index Type Argument Description 0ChartType | string Type of renderer, e.g. "bar", "line".
1string <optional>
Symbol for which this renderer applies, if omited, default symbol.
2RendererParameters <optional>
Optional renderer parameters.
studiesArray.<string> <optional>
List of study names. These names must exist in the configuration under studies/types. See StudyConfig.
Example
Load two symbols, with GOOG as the main symbol and displaying as a mountain chart with a y-axis on the right (default), while AAPL is a colored bar chart with y-axis on the left. Events for both symbols are loaded, with the colors of the markers determined by theme. A Moving Average Cross and Volume study are loaded (they pertain to the default symbol).
config.initialization = { symbols: [{ symbol: "AAPL" }, { symbol: "GOOG", main: true }], events: [ { symbol: "AAPL", params: { color: "*ec1" } }, { symbol: "GOOG", params: { color: "*ec2" } } ], renderers: [ ["mountain"], ["colored_bar", "AAPL", { yAxis: { position: "left" } }] ], studies: ["maCross", "vol"] )} -
Layout
-
Defines the layout of the chart.
Type:
- Since:
-
9.4.0
Properties:
Name Type Description candleWidthnumber Number of pixels for a bar.
intervalTimeUnit | number Chart interval.
periodnumber Chart period. Value above 1 causes consolidation to occur.
-
LayoutConfig
-
Allows initialization of layout when chart is loaded.
Type:
- object
- Since:
-
- 9.4.0 Introduced
- 9.8.0 added
tooltip.
Properties:
Name Type Argument Default Description adjboolean <optional>
true Use adjusted close.
candleWidthnumber <optional>
8 Number of pixels for a bar.
chartScalestring <optional>
linear Type of scaling for main chart y-axis.
crosshairboolean <optional>
false State of crosshair display, false is hidden.
currentValuesboolean <optional>
false Set to true to display current values in the headsUp, otherwise crosshair values are shown,.
eventsboolean <optional>
true Set to true to show events.
extendedHoursboolean <optional>
false Set to true to show extended hours data.
intervalTimeUnit | number <optional>
'day' Chart interval.
marketSessionsRecord.<string, number> <optional>
{} Market sessions available and whether to display them, e.g. { pre: true, post: true }.
periodnumber <optional>
1 Chart period. Value above 1 causes consolidation to occur.
signalDataboolean <optional>
true Set to true to show signals.
spanobject <optional>
If not undefined (default), contains span parameters.
Properties
Name Type Argument Description basestring Span range unit (day, month, etc).
multipliernumber Multiple of span base unit.
forceLoadboolean <optional>
If set, will force new load regardless of previous periodicity setting.
periodicityPeriodicity <optional>
Span periodicity.
timeUnitTimeUnit <optional>
<nullable>
Used to represent units of interval.
tooltipboolean <optional>
false Set to true to display a tooltip with crosshair values.
-
MetaConfig
-
High-level configuration of the CompactChart. This property must be provided as it contains the licenseKey function. It also contains optional metrics logging configuration.
Type:
- object
- Since:
-
- 9.4.0 Introduced
- 10.1.0 Added property
ecosystem.
Properties:
Name Type Argument Description keyFnfunction The getLicenseKey function imported from key.js REQUIRED for proper functionality.
metricsEnabledboolean <optional>
Set to true to turn on metrics logging.
metricsURLstring <optional>
URL of metrics server.
ecosystemboolean <optional>
Indicates that chart shares the page with other resources and should not attempt to modify page-level attributes.
Example
Initializing `meta` in configuration:
import getLicenseKey from "../key.js"; ... const config = { ... meta: { keyFn: getLicenseKey }, ... } -
Periodicity
-
Chart Periodicity representation.
Type:
- object
- Since:
-
9.4.0
Properties:
-
Preferences
-
Chart user preferences.
Type:
- object
- Since:
-
9.4.0
Properties:
Name Type Argument Description localestring <optional>
Name of locale. The appropriate language file will load and the dates and numbers on the chart will be displayed according to the locale. Languages are configured in files named for each locale in
js/modules/languages.themestring <optional>
Name of theme to load. Themes are configured in files named for each theme in
js/modules/themes. Without a theme specified, the chart will draw in its default grayscale theme.timeZonestring <optional>
<nullable>
IANA time zone name to use for the displayed time zone (x-axis)
-
Series
-
A simple object representing a series that is on the chart.
Type:
- object
- Since:
-
9.4.0
Properties:
Name Type Argument Description symbolstring Symbol of the series.
marketstring <optional>
Name of market the series belongs to.
-
SingleThemeConfig
-
Configure a theme available to the chart.
Type:
- CommonModuleConfig.<Theme>
- Since:
-
9.4.0
-
ThemesConfig
-
CompactChart supports theming. In the
js/modules/themesfolder there are a few themes supporting Day, Night, and colorblind-friendly themes. More themes may be added simply by creating a copy of the default theme file found in the themes folder, renaming it to the desired theme name, and setting the properties in the file. To provide support for a theme, include its name in the themes section of the configuration. Remember, theme properties combine with general properties. If you wish to remove a feature by removing it from the configuration, don't forget to remove it from the themes files as well. If you do not wish to support themes, but wish to adjust a property normally associated with themes, like a color or font, you can do so by setting the property directly in the configuration file. If no theme is set and no properties related to theming are set either, the chart will fall back on default grayscale theming.Type:
- Record.<string, (SingleThemeConfig|null)>
- Since:
-
9.4.0
Example
Sample theme configuration:
themes: { night: { modulePath: "./modules/themes/night.js" }, night_cb: { modulePath: "./modules/themes/night_cb.js" }, day: { modulePath: "./modules/themes/day.js" }, day_cb: { modulePath: "./modules/themes/day_cb.js" }, none: null } -
TimeUnit
-
Possible values of the Periodicity object's interval or timeUnit property.
Type:
- 'millisecond' | 'second' | 'minute' | 'day' | 'hour' | 'week' | 'month' | 'year' | 'tick'
- Since:
-
9.4.0
-
TimezoneConfig
-
Configure which timezones are available to the chart. By default, four time zones are available: UTC, Europe/London, Asia/Tokyo, and America/New_York. Importing the timezones example file in
examples/timezones.jsprovides many more timezones. Import the timezones file like so:import * as Timezones from "../examples/timezones.js";Then you can use the imports in your config:
timezoneSupport: { modulePath: "./modules/timezone.js", rules: Timezones.rules, zones: Timezones.zones }Note: these settings should reference the timezone module at
js/module/timezone.js, not the example Timezones file. Note: any custom rules or zones must be formatted in accordance with IANA formatting https://www.iana.org/time-zones/repository.Type:
- CommonModuleConfig.<TimezoneJS>
- Since:
-
- 9.4.0 Introduced
- 10.1.0 Added
citiesparameter`.
Properties:
Name Type Argument Description citiesRecord.<string, string> <optional>
City/time zone offset map imported from Timezones example (
Timezones.timezoneMap), or custom mappingrulesRecord.<string, Array.<Array>> <optional>
Rules imported from Timezones example (
Timezones.rules), or custom rules.zonesRecord.<string, (string|Array.<Array>)> <optional>
Zones imported from Timezones example (
Timezones.zones), or custom zones.
