This question is locked. New answers and comments are not allowed.
hi,
here is my scenario: i have a line-chart with a lots of data (30.000 points), x-axis is datetime, y-axis are double values. what i want to do is, if i click somewhere in the chart a marker (vertical and horizontal line on the whole chart area like a cross) should appear on the next datapoint and the values are supposed to be writen in a textblock.
further, it should be possible to add several markers to one chartarea and select each of them by clicking on a label or something similar.
how can i implement this feature? and how can i receive the mouse-click-coordinates?
thx in advance
my code:
XAML:
<Grid x:Name="LayoutRoot">
<my:RadChart x:Name="chart" Width="800" Height="500" MouseLeftButtonDown="MouseClicked"></my:RadChart>
</Grid>
CS:
public ChartControl()
{
InitializeComponent();
ConfigureChart();
FillSampleChartData();
}
private void ConfigureChart()
{
chart.DefaultView.ChartArea.EnableAnimations = false;
chart.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
chart.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;
chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MMMM yyyy";
SeriesMapping temperatureMapping = new SeriesMapping();
LineSeriesDefinition lineDefinition = new LineSeriesDefinition
{ShowItemLabels = false, ShowPointMarks = false};
temperatureMapping.SeriesDefinition = lineDefinition;
temperatureMapping.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XValue));
ItemMapping yItemMapping = new ItemMapping("Value", DataPointMember.YValue)
{SamplingFunction = ChartSamplingFunction.Average};
temperatureMapping.ItemMappings.Add(yItemMapping);
chart.SeriesMappings.Add(temperatureMapping);
}
private void FillSampleChartData()
{
chart.ItemsSource = LoadTemperaturesFromDB(); //loads approx. 30.000 points from db
}
here is my scenario: i have a line-chart with a lots of data (30.000 points), x-axis is datetime, y-axis are double values. what i want to do is, if i click somewhere in the chart a marker (vertical and horizontal line on the whole chart area like a cross) should appear on the next datapoint and the values are supposed to be writen in a textblock.
further, it should be possible to add several markers to one chartarea and select each of them by clicking on a label or something similar.
how can i implement this feature? and how can i receive the mouse-click-coordinates?
thx in advance
my code:
XAML:
<Grid x:Name="LayoutRoot">
<my:RadChart x:Name="chart" Width="800" Height="500" MouseLeftButtonDown="MouseClicked"></my:RadChart>
</Grid>
CS:
public ChartControl()
{
InitializeComponent();
ConfigureChart();
FillSampleChartData();
}
private void ConfigureChart()
{
chart.DefaultView.ChartArea.EnableAnimations = false;
chart.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
chart.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;
chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MMMM yyyy";
SeriesMapping temperatureMapping = new SeriesMapping();
LineSeriesDefinition lineDefinition = new LineSeriesDefinition
{ShowItemLabels = false, ShowPointMarks = false};
temperatureMapping.SeriesDefinition = lineDefinition;
temperatureMapping.ItemMappings.Add(new ItemMapping("Date", DataPointMember.XValue));
ItemMapping yItemMapping = new ItemMapping("Value", DataPointMember.YValue)
{SamplingFunction = ChartSamplingFunction.Average};
temperatureMapping.ItemMappings.Add(yItemMapping);
chart.SeriesMappings.Add(temperatureMapping);
}
private void FillSampleChartData()
{
chart.ItemsSource = LoadTemperaturesFromDB(); //loads approx. 30.000 points from db
}