|
How to display the label with min max & Avearage value |
Posted by Ram on Feb-26-2016 23:16 |
|
Hi ,
I would like display the label with min , max and Average of y-axis value .
I am using javascript for that and how to achieve that.
Using XY chart.
Thanks,
Ram |
Re: How to display the label with min max & Avearage value |
Posted by Peter Kwan on Feb-27-2016 05:26 |
|
Hi Ram,
Would you mind to clarify what type of min, max and average values are you referring to? Do you mean the min and max values of the y-axis scale, or are you referring to the min and max values of your data or other things?
The meaning of min and max and average values can depend on the type of chart. Is it possible to attach an image to help me understand what type of chart you are drawing, and where would you like to put the min/max/avg values?
Regards
Peter Kwan |
Re: How to display the label with min max & Avearage value |
Posted by Ram on Feb-29-2016 18:57 |
|
Yes .max ,min and average value of y-axis scale and I want this to displayed as legend at the bottom the graph and It is trend line graph |
Re: How to display the label with min max & Avearage value |
Posted by Peter Kwan on Mar-01-2016 01:25 |
|
Hi Ram,
The min, max and average value of the y-axis scale would not change unless the chart is updated. So it is best to generate the labels when the chart is being created. For example, in C#, it is like:
.... create chart as usual ....
// auto-scale the axis, so we can know the axis scale
c.layout();
c.addText(c.getWidth() / 2. c.getHeight() - 5, "Max = " + c.yAxis().getMaxValue() + ", Min = " + c.yAxis().getMinValue() + ", Avg = " + (c.yAxis().getMaxValue() + c.yAxis().getMinValue()) / 2.0, "Arial Bold", 8, 0x000000);
If you are generating the text dynamically when the mouse moves, you can also use c.yAxis().getMaxValue() and c.yAxis().getMinValue() on the browser side with Javascript.
Hope this can help.
Regards
Peter Kwan |
|