Class: Lines

CIQ.Renderer. Lines


new Lines(config)

Creates a Lines renderer.

This renderer will draw lines of various color, thickness and pattern on a chart.

The Lines renderer is used to create the following drawing types: line, mountain, baseline, wave, step chart, and colored versions of these. Note: by default the renderer will display lines as underlays. As such, they will appear below any other studies or drawings.

See CIQ.Renderer#construct for parameters required by all renderers

Parameters:
Name Type Description
config object

Config for renderer

Properties
Name Type Argument Description
params object <optional>

Parameters to control the renderer itself

Properties
Name Type Argument Default Description
width number <optional>

Width of the rendered line

type string <optional>
"line"

Type of rendering "line", "mountain", "wave"

useChartLegend boolean <optional>
false

Set to true to use the built in canvas legend renderer. See CIQ.ChartEngine.Chart#legendRenderer;

highlightable boolean <optional>
true

Set to false to prevent selection of series via hover

style string <optional>

Style name to use in lieu of defaults for the type

step boolean <optional>

Specifies a step chart

baseline boolean <optional>

Specifies a baseline chart

colored boolean <optional>

Specifies the use of a colorFunction to dictate color of the segment

vertex boolean <optional>

Specifies drawing a dot on every vertex

vertex_color boolean <optional>

Specifies a color for the vertices. If omitted, will use defaultColor.

colorFunction string <optional>

Override string (or function) used to determine color of bar. May be an actual function or a string name of the registered function (see CIQ.Renderer.registerColorFunction)

Common valid parameters for use by attachSeries. See also CIQ.ChartEngine#plotLine:
color - Specify the color for the line in rgba, hex or by name.
pattern - Specify the pattern as an array. For instance [5,5] would be five pixels and then five empty pixels.
width - Specify the width of the line.
baseColor - Specify the color of the base of a mountain.
fillStyle - Specify an alternate color to fill a mountain (other than color).

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, and colorFunction parameters
Examples
// add multiple series and attach to a custom y-axis on the left.
	// 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
	var 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
	var renderer=stxx.setSeriesRenderer(new CIQ.Renderer.Lines({params:{name:"lines", 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 is an example on how completely remove a renderer and all associated data.
		// This should only be necessary if you are also removing the chart itself.

		// remove all series from the renderer including series data from the masterData
  		renderer.removeAllSeries(true);

  		// detach the series renderer from the chart.
  		stxx.removeSeriesRenderer(renderer);

  		// delete the renderer itself.
  		renderer=null;
// Colored step baseline mountain with vertices
		var renderer=stxx.setSeriesRenderer(new CIQ.Renderer.Lines({params:{name:"lines", type:"mountain", baseline:true, step:true, colored:true, vertex:true, yAxis:axis}}));

Methods


requestNew(featureList)

Returns a new Lines renderer if the featureList calls for it FeatureList should contain whatever features requested; valid features: line, mountain, baseline (delta), 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

config.params object <optional>

Parameters used for the series to be created, used to create the renderer

Since:
  • 5.1.0
Returns:

A new instance of the Lines renderer, if the featureList matches

Type
CIQ.Renderer.Lines