new Lines(config)
Creates a lines renderer.
This renderer draws lines of various color, thickness, and pattern on a chart.
The Lines
renderer is used to create the following chart types (including colored versions):
line, mountain, baseline, wave, and step chart.
Note: By default, the renderer displays lines as underlays. As such, they appear below any other studies or drawings.
See CIQ.Renderer#construct for parameters required by all renderers.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | Configuration object for the renderer. Properties
|
- Since:
-
- 4.0.0 New
config.params.useChartLegend
added. - 5.1.0 Removed subtype parameter, this will be determined internally from
config.params.step=true
. - 5.1.0 Added
highlightable
,overChart
,step
,baseline
,vertex
,style
,colored
, andcolorFunction
parameters. - 8.1.0 Added CIQ.ChartEngine.Chart#baseline type to
baseline
parameter. The new type contains adefaultLevel
property which can be set to the desired baseline value. See example below. - 8.9.3 Added centered flag for baseline.
- 4.0.0 New
Examples
const baseLineRenderer = new CIQ.Renderer.Lines({
params: {
baseline: {defaultLevel: 45},
yAxis: true
}
});
stxx.addSeries("GOOG");
stxx.setSeriesRenderer(baseLineRenderer).attachSeries("GOOG").ready();
// or
stxx.addSeries("GOOG", {baseline: {defaultLevel: 105}, color: "purple"});
// See this example working here: https://jsfiddle.net/chartiq/b6pkzrad.
// Note how the addSeries callback is used to ensure the data is present before the series is displayed.
// Create the custom axis.
const axis = new CIQ.ChartEngine.YAxis();
axis.position = "left";
axis.textStyle = "#FFBE00";
axis.decimalPlaces = 0; // No decimal places on the axis labels.
axis.maxDecimalPlaces = 0; // No decimal places on the last price pointer.
// Create the renderer.
const renderer = stxx.setSeriesRenderer(
new CIQ.Renderer.Lines({
params: {
name: "my-renderer",
type: "mountain",
yAxis: axis
}
})
);
// Create your series and attach them to the chart when the data is loaded.
stxx.addSeries("NOK", {display: "NOK", width: 4}, function() {
renderer.attachSeries("NOK", "#FFBE00").ready();
});
stxx.addSeries("SNE", {display: "Sony", width: 4}, function() {
renderer.attachSeries("SNE", "#FF9300").ready();
});
// This should only be necessary if you are also removing the chart itself.
// Remove all series from the renderer, including series data from masterData.
renderer.removeAllSeries(true);
// Detach the series renderer from the chart.
stxx.removeSeriesRenderer(renderer);
// Delete the renderer itself.
renderer=null;
const renderer = stxx.setSeriesRenderer(
new CIQ.Renderer.Lines({
params: {
name: "my-renderer",
type: "mountain",
baseline: true,
step: true,
colored: true,
vertex: true,
yAxis: axis
}
})
);
Methods
-
requestNew(featureList [, params])
-
Returns a new Lines renderer if the featureList calls for it FeatureList should contain whatever features requested; valid features: line, mountain, baseline (delta), baseline (noncentered), step, vertex, colored, wave Anything else is an invalid feature and will cause function to return null Called by CIQ.Renderer.produce to create a renderer for the main series
Parameters:
Name Type Argument Description featureList
array List of rendering terms requested by the user, parsed from the chartType
params
object <optional>
Parameters used for the series to be created, used to create the renderer
- Since:
-
- 5.1.0
- 8.9.3 Added support for baseline_noncentered.
Returns:
A new instance of the Lines renderer, if the featureList matches
- Type
- CIQ.Renderer.Lines