How to add math equations in highcharts? - highcharts

I am new in Highcharts. I want to add a mathematical equation in highcharts as example (y=3x+5) . How can i generate the function and pass data to highchart series.
Please help :) Thanks in advance...

Highcharts has no implemented this kidn of solutions, but you can prepare your own function which calculate point values and prepare array with all of them (used by series).

yes, you can generate the data to be used to plot the data before the chart is rendered. i've seen this example in highcharts demos where in they have used a function which returns the data to be plotted.
here is the js fiddle of that
http://jsfiddle.net/HHPm7/
like you said using an equation like
y = (3 * x) + 5
http://jsfiddle.net/HHPm7/1/
I hope this will be useful

Related

How to shift data on xAxis to right on Daniel Gindi charts?

I have a data chart DataChart would like to shift data of xAxis along with data lines to right by certain value.
DataChart Screen Shot
Please help me out which property to use from the library that would be able to solve this purpose.
I am using Daniel Gindi line charts for this purpose.
I use this to create an offset to the left of my chart
myChart.xAxis.spaceMin = 10
maybe it'll do for you
And to align the yAxis lines in front of the labels, i think you could remove the background grid and create your own limit lines if you don't find any other way around
is it viable to subtract the distance d from the x values? that would shift it rightward.
d = 7.0
rightShifted = newGraphData.values.map{ChartDataEntry(x:$0.x-d, y:$0.y)}

iOS Charts graphing a line from a function

I am using the iOS-charts library in (Swift 3) to plot my data into a scatter chart. I can do this part easily but now I am trying to get a non-linear best fit line to display too. Does the charts library have any easy functions for finding a best fit line, and if not how do I create a line from a function if a have to derive the best fit line function myself. I know how to create a line graph from data points but do not know if charts allows you to make one from a function. An example of what I'm trying to do is above. Any help is appreciated thanks.
Link to iOS-charts
http://www.appcoda.com/ios-charts-api-tutorial/

Stacked value with line chart with highcharts

I got an situation like this. I would like to using line chart to draw stacked value. I have tried google search but i can't find the solution.
For example: On date May/23 i got 3 values, i would like to display these on line-chart.
How could i achieve this? Does highcharts support to do this one. Please take a look at the link attach to clearer the question
Stacked line chart image
Addition info: Im using highcharts to do this one
Thanks for any comment or answer
Follow jlbriggs
I should use scatter-chart to achieve this one
Regarding the tooltip, I would suggest using a scatter series instead of a line. Set the lineWidth in the plotOptions and it will plot just like a line series, but the tool tips are handled differently. Example: jsfiddle.net/jlbriggs/c1o8Lwgv

Plot series that cannot be sorted avoiding Highcharts error 15

2nd EDITION:
I'm re-frasing the question in hope to be more clear.
I have a data series like:
[ [-3,30], [-2,40], [1,50], [3,60], [2,50], [-1,40], [-4,30] ]
I need Highcharts to plot it in a graphic like a line. Highcharts gives the error 15 because the series is not sorted.
Problem is that the series cannot be sorted because it would falsify the data output. The examples on the pictures and the fiddle show the expected result and what happens if the series get sorted (a blurred plot):
Result expected
Result from sorting data
fiddle plot in my comment (can't attach the link here)
I tried spline and area but both give the error 15.
I tried polygon that avoids the error 15 but it plots a filled area and I cannot get only the borders.
Is there a way to work around this?
Just got a solution from the Highcharts forum, by Izothep (big thanks for him):
with scatter http://jsfiddle.net/izothep/pfddg2je/17/
with polygon http://jsfiddle.net/izothep/45v6xefb/1/
Sorry but I don't have the rights yet to post the fiddle links directly.
If you have more than one series you can, for instance, loop through the Highcharts.getOptions().colors[ i ], were i is the series number, and set it on the lineColor and the color on the called 'fake' on the presented solutions.

Possible to Draw a Loop With HighCharts

We are currently using HighCharts for our typical bar, pie, line charts. But, we have been asked to plot some medical data that would end up resembling an irregular loop.
If I have an array of x,y points, would it be possible for me to draw this sort of graph with HighCharts? And, if so, can you point me to the right section of the documentation. I see that drawing things like rectangles and circles is possible, but I haven't found any info on drawing lines between arbitrary points.
I can see only three ways to achieve that, and none of them is easy, and have some limitations:
1) Use spline series with unsorted data - looks almost good, only tooltip doesn't work for unsorted data
2) Use scatter series with unsorted data - issue with tooltip is gone, but curves aren't smooth
3) Use renderer.path - doesn't have tooltip at all, and requires to add path manually.
And example of all three: http://jsfiddle.net/kEu3w/

Resources