My user has asked me to display a xamdatachart with the Y axis pre-scaled to some arbitrary value. By this I mean that before a single data element is loaded, the y axis should be scaled between, say, 0 and 20. The chart should re-scale itself no differently than it does now and should respect min and max no differently than it does now.
Is it possible to do this?
Hello Sam,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Thank you Stefan, as usual I got pulled away on another issue. I will be working on this in the next day or so.
Stefan, after reviewing your example it came to me that I was asking the wrong question.
The issue we are having is that we are plotting bars with values that vary widely. We update the chart with a timer. When a bar is first plotted it may have a value of, say, 5. That value may grow to, say, 2000. If we set the Y axis interval too large, we dont see any ticks when the value of the bar is small. If we set the interval too small, we see many ticks all scrunched together when the value of the bar is large.
New question: Is there a way to set the number of tick marks to plot instead of the tick mark interval. For example, we always want to see 5 ticks. The interval should be the value of the largest bar / 5. So if there is one bar displayed, and it's value is 100, we the tick interval should be 20 (not couting the x axis or the top of the chart as a tick).
At the moment I am able to accomplish the above by binding the Y axis interval to a property on my viewmodel and calclulating each time my data changes. If it is not already there, I think it would be more efficient if that logic were moved to the chart control
I have modified the sample I sent you before, so now it has the functionality you want. Basically I used a MultiConverter to calculate the Interval of the NumericXAxis based on the minimum and maximum values. This way every time the data changes the interval will be recalculated. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.