jQWidgets Forums
jQuery UI Widgets › Forums › Chart › draw line on chart
Tagged: draw line
This topic contains 2 replies, has 2 voices, and was last updated by shawn 5 years, 7 months ago.
-
Authordraw line on chart Posts
-
I have a line chart which works fine.
The data that is supplied does not include the average of all points on the chart.
I can calculate the average, but I can’t figure out how to just draw a line on the chart.
I just want to draw a straight line on the chart that shows the average value.
My current code looks like this:var settings = { title: "download/uploads results", description: "", padding: { left: 15, top: 15, right: 15, bottom: 15 }, titlePadding: { left: 90, top: 0, right: 0, bottom: 10 }, source: chartData, colorScheme: 'scheme01', xAxis: { dataField: 'dts', showGridLines: true, labels: { angle: -65, rotationPoint: 'topright', offset: { x: 0, y: -60 } } }, valueAxis: { minValue: 0, maxValue: 100, unitInterval: 10, description: 'down/uploads' }, seriesGroups: [ { type: 'line', series: [ { dataField: 'download', displayText: 'download'}, { dataField: 'upload', displayText: 'upload'} ] } ] };
Hello shawn,
With the “bands” member of the “seriesGroups” property of the jqxChart you could draw a line:
https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/javascript_chart_color_bands.htm
Or in the relevant “axis” option:
https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/javascript_chart_color_bands_x_axis.htm
Another option if you want you could add custom lines in the “valueAxis“ and in the “xAxis” property:
https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/javascript_chart_custom_offsets.htm?light
Please, take a look at this demo, too:
https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/javascript_chart_annotations.htm?light
Also, there is our jqxDraw plug-in which you could use.Best Regards,
Hristo HristovjQWidgets team
https://www.jqwidgets.comjust what I was looking for, thanks
-
AuthorPosts
You must be logged in to reply to this topic.