I am facing this same issue almost. I want to draw an XYplot with known preset horizontal axis values. The only variable is the Y points' value.PB wrote:
Further suggestions
I recommend implementing an optional "nice labels" function, the charts look prettier/natural when used. It may not be obvious with sample data, but when you have a lot of varied natural data, the numbers chosen for tick label can look odd to an end user. On a similar note a better default autodetection of label format may be also a good idea, display of labels is currently fixed at two decimal places at the moment, regardless of the magnitude of values of data linked with an axis. Of course, both these things can be easily done by an application programmer just as I did, but I believe it's for the best if such common functions are implemented within the library itself and the sensible defaults should be applied without application programmer intervention.
So if for example i have 4 horizontal axis values like 100, 1000, 4000, 10000 and a Y value for each one of these, the code will calculate a tick value for each point like this :
Code: Select all
tick = (max - min) / (pointsCount - 1)
The XYline draws correctly on the chart so this is something that someone would expect from a chart like this. But what if i wanted to use the same x values and draw the XYline related to that? What i want to do is a "nice labels/nice plot" kind of thing with all x values evenly spaced and the same for the XYline. The closest thing that i could find is the BarPlot but i dont want to use bars. My guess is that the x axis values should be strings and the Y should be double or intergers. But where and how should i change the code to do what i want? I guess that there is some piece of code that calculates the tick values and draws the x axis values and the XYline according to that and the drawing rectangle but i cant really find it. Can anyone help here?