-
-
Jason
-
2,661 posts
|
Hello Nicklas
I have further improved the minimum and maximum binding for the ChartAxis in the next nightly build. The reason why it did not work is the ChartAxis internally makes sure that Minimum can not be larger than Maximum. If this occurs, the Chart axis will set one of the properties to ensure this invariant. If the property only has a one way binding, then setting the property internally causes the binding to be removed and effectively overwritten with the set value. I've modified this so the Minimum and Maximum properties can not be set during the loading process. NOTE however that if you break this invariant dynamically during run time (like in your sample you can use the date editors to cause minimum to be larger than maximum), then the axis will correct it's min/max values internally and the binding will be removed. If this is something that can occur in your application, then you'd be best to go with a two way binding as this is not overwritten when manually setting a property. This is a troublesome aspect of WPF data binding that we can not do anything about.
The equation used to plot the points on the line is the same one used to position the tick marks. Both the chart area and axis are lined up exactly with each other. The reason why this can sometimes occur is just the way WPF works out which pixels to render the line at. You may notice that zooming the chart in and out, the line can correctly line up with the tick mark. I have tried many times to counteract this issue, but this just causes the line to occasionally appear above the tick mark instead of below it. The most I've seen the line be offset is at most 1 pixel. You can work around this by setting the line thickness to 2 which can line it up more accurately.
The only way I can think of this occurring is if the custom foreground element could cause the chart to be remeasured. I'd need a repro project to see if this is the case though.
I am not completely sure what you mean here, but I find that making the foreground element extend Canvas and then adding elements to the canvas is the best way to build a foreground element. Also, set Chart.IsChartClipped to false to prevent the main charting area from clipping the foreground elements.
By setting IsChartClipped to false, lines and chart symbols can be rendered over the top of the axis lines. Another option is to set the padding of the chart axis. For example, on the Y axis you can set the padding to something like 0,5,0,5 which will push the tick marks and plotted data vertically inward by 5 pixels at the top and bottom.
Let me know if you need further help with any of this.
Jason Fauchelle
|