Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to draw a rectangle over a charting element?

I have some XAML like this drawing a scatterplot of a time series (X-Axis: DateTime, Y-Axis: Integer Value):

<Grid Name="chartgrid">
    <charting:Chart Name="scatterplot">
    </charting:Chart>
</Grid>

I am able to add a graphic object such as a line to this grid as one of its children but have to do so using X and Y coordinates that are different from the ones used by the chart control. Of course this is expected because the chart sets up its own axis.

The only approach I could think of is to add some dummy points to the graph as a different series but am hoping there is a better way to do this. Any suggestions?

EDIT: Added a figure to clarify further.

enter image description here

like image 425
Legend Avatar asked Jan 21 '26 11:01

Legend


1 Answers

The only way I can think of is by examining the Virtual Tree looking for both axis objects.

Perhaps by using the VisualTreeHelper

Once you know their positions and their sizes combined with the scale information you can hopefully get from the chart control you could calculate the transformation from chart point to Silverlight coordinate.

like image 198
Emond Avatar answered Jan 23 '26 01:01

Emond



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!