|
line chart show interpolated values |
Posted by frank_de on Apr-10-2013 15:32 |
|
I will display RGB values from a picture in a line chart diagramm. When I add the values to the diagramm the chartdirector interpolate values. In the attachment I have a R-Value of 0 but the Charts shows a value of 0.5, that is wrong. In the legend I can see the right value. What can I do to see only values in the diagramm which I added with addDataSet? When I zoom in the diagramm I can see the the right values.
|
Re: line chart show interpolated values |
Posted by Peter Kwan on Apr-11-2013 04:22 |
|
Hi frank_de,
I suspect ChartDirector in fact plots the line to 0. However, in the chart, you cannot see that part becuase it is behind the 2-pixel wide vertical axis.
To check if this is the case, may be you can add a small margin between the origin and the vertical axis using (in C#):
//2-pixel margin
c.xAxis().setMargin(2, 2);
If you can now see the red line connected to 0, then it confirms the line is there, but is blocked by the vertical axis. In this case, you can add a margin using Axis.setMargin, or use a thinner axis or even a transparent axis (like in the "Uneven Data Points" sample code).
Regards
Peter Kwan |
Re: line chart show interpolated values |
Posted by frank_ge on Apr-11-2013 19:10 |
|
Thanks for your answer Peter, but that is not the solution of my problem. It doesn't change anything. I made some changes and tests and found out the following.
I added a dataset to a layer. In this dataset are ohne integer values ( 1, 1, 1, 3...). After adding the dataset I requested this dataset from the layer and ask for the values. The values I got are not the same that I inserted, they are interpoated ( 1.28, 2, 1.14, 2,57,..). Why ? Can I set an option to the dataset or layer to get the same values that I added ? In this case I think I see the right values in the diagramm.
thanks and regards
Frank |
Re: line chart show interpolated values |
Posted by Peter Kwan on Apr-12-2013 02:11 |
|
Hi frank_ge,
ChartDirector should not "interpolate" or modify the data in any way. Is it possible your code modifies the data (such as grouping the data points together by avergaing) before passing the data to ChartDirector?
From your image, it seems you are using ChartDirector 5.1. It is because your screen shot seems to have a "track cursor", which is a new feature in ChartDirector 5.1. Is this the case?
In older versions of ChartDirector, in one of the zooming/scrolling sample code, if there are more data points than the number of pixels in width, the code would "aggregate" the data into fewer points before passing the data to ChartDirector.
For example, if there are 10000 visible data values but the chart width is just 500 pixels, the code would aggregate the data to around 500 values, before passing the values to ChartDirector. The reduction method in the sample code is by grouping and averaging.
(Of course, your own code can choose not to use aggregation, or to use another aggregate method instead of averaging.)
One effect of "aggregation" is that the average values are not the same as the original data values. In ChartDirector 5.1, due to the track cursor feature, the sample code no longer perform aggregation (as people expect to see the real values on the track cursor, not the aggregated values). Instead, all data values are passed to ChartDirector 5.1, and there is a new API LineLayer.setFastLineMode to speed up the plotting.
Are your code derived from older versions of ChartDirector, and it aggregates the data before passing them to ChartDirector (that is, the data used in addDataSet is not the original data but the aggregated data)? If this is the case, please modify it so that it no longer aggregates the data, and add the LineLayer.setFastLineMode call to speed up the plotting.
If the above still does not solve the problem, is it possible to inform me the charting part of your code (if you cannot post your code in this forum, you may email me at pkwan@advsofteng.net), so I may try to reproduce the problem?
Regards
Peter Kwan |
|