An AVG point in my graph

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Kalle on 23rd July 2014
Is there any way to set an avg point or line of the data im storing in the graph ?
Posted by Richard on 23rd July 2014
API
There's no facility to draw an "average line" in RGraph itself - but its easy enough to do yourself using the canvas API. You can use the context that you can get at:

obj.context

And depending on the chart type that you're using the correct Y coordinate for a particular value can be determined using:

y = obj.getYCoord(value);




Richard
Posted by Kalle on 24th July 2014
Hey
Im using the www.rgraph.net/examples/bar-line-and-pie-charts.html

Well what should i do with the y then ? If i put the Y in my graph where i have my data disent the other data get ruined then ?

In the values of the graph i have sql questions..
can u give me an example of doing this by not destry my data presented


             <script>
                 $(document).ready(function ()
                 {
                 var pie = new RGraph.Pie('cvs_RunTime_Vendor', [4,8,6])
                 .set('shadow', true)
                 .set('shadow.blur', 10)
                 .set('linewidth', 2)
                 .set('colors', ['#ffce0d'])
                 .set('shadow.color', '#aaa')
                 .set('shadow.offsetx', 0)
                 .set('shadow.offsety', 0)
                 .set('strokestyle', 'rgba(0,0,0,0)')
                 .set('labels', ['Henning','Louis','John'])
                 .roundRobin()
                 })
             </script>
Posted by Richard on 24th July 2014
You can't have an average line with a Pie chart - there's no way to represent it. You could try a Bar chart:

www.rgraph.net/fiddle/view/a-bar-chart-with-an-average-value



Richard
Posted by Kalle on 24th July 2014
ohh sry i posted a pie. This is my graph and i want a avg on the data..Is it possible to set avg line on labels my time line in the x axel ? thx for the help


<!-- <canvas id="graph_storage" width="1100" height="300">[No canvas support]</canvas>
             <script>
                 $(document).ready(function ()
                 {
                 var bar = new RGraph.Bar('graph_storage', <%="[[" & GetErrorsInTimePerScript(iscript,iType,0,2400,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,2400,4800,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,4800,7200,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,7200,9600,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,9600,12000,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,12000,14400,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,14400,16800,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,16800,19200,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,19200,21600,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,21600,24000,imonthsback2) & "],[" & GetErrorsInTimePerScript(iscript,iType,24000,1000000000,imonthsback2) & "]]"%>)
                 .set('labels', ['0-40h','40-80h','80-120h','120-160h','160-200h','200-240h','240-280h','280-320h','320-360h','360-400h','400h+'])
                 .set('colors', ['Gradient(#3C3C3C:#323232)'])
                 .set('hmargin', 10)
                 .set('strokestyle', 'white')
                 .set('linewidth', 1)
                 .set('shadow', true)
                 .set('shadow.color', '#ccc')
                 .set('shadow.offsetx', 0)
                 .set('shadow.offsety', 0)
                 .set('shadow.blur', 10)
                 .set('labels.above', true)
                 .set('labels.above.decimals', 1)
                 .set('labels.above.size', 12)
                 .draw();
                 })-->
             </script>
Posted by Richard on 24th July 2014
I can't tell what you're asking. Try posting a URL to a picture that illustrates what you want.


Richard
Posted by Kalle on 24th July 2014
piclair.com/1q34q


Something like this, but i maybe cant do it cause my labels are hardcoded..hmmm
Posted by Richard on 24th July 2014
Unfortunately that doesn't help because I still can't tell what it is that you want to draw on your chart.


Richard

Add a reply




« Back to message list