Customize silverlight line chart
I am trying to make chart something like this Line Chart in silverlight using C# in VS 2010.I am trying to get values at each point in Graph
Till now my code is as follows
<toolkit:Chart Width="800" Height="175" Name="LineChart" MouseMove="LineChart_MouseMove"> <toolkit:Chart.Series> <toolkit:LineSeries IsSelectionEnabled="True" Title="Visits" ItemsSource="{Binding}" IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Types}"/> </toolkit:Chart.Series> <toolkit:Chart.Axes> <toolkit:CategoryAxis Orientation="Y"></toolkit:CategoryAxis> <toolkit:LinearAxis Orientation="X"></toolkit:LinearAxis> </toolkit:Chart.Axes> </toolkit:Chart>
and my Linechart_MouseMove code is as follows
private void LineChart_MouseMove(object sender, MouseEventArgs e) { try { Point coordinate = e.GetPosition((Series)LineChart.Series[0]); ICategoryAxis xAxis = (CategoryAxis)LineChart.Axes[0]; IRangeAxis yAxis = (LinearAxis)LineChart.Axes[1]; object Val = coordinate.X; //object Val2 = coordinate.Y; object Val2 = new object(); //var xHit = xAxis.GetCategoryAtPosition((System.Windows.Controls.DataVisualization.UnitValue)Val); Val2 = yAxis.GetValueAtPosition((System.Windows.Controls.DataVisualization.UnitValue)Val2); } catch { } }
Can anyone please help..Thanks in advance
Answers & Comments...
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog