I'm using dynamicdatadisplay library for WPF! not SilverLight
I've finish my backend codding already and stuck with graph.
I have an X-Axis that is a DateTime (hours).
Also I Have an Y-Axis that is Decimal.
But I can't find how to put between this axes custom marker (or whatever) which will be a dynamic string.
For example in 10 hours 03.11.2013 (x-axis) the price of the Stock was 120$ (y-axis) but in graph (in the cross of the axes) it must be a string "Volume: 50" which will show how much stocks was sell.
How to make it in code? Please give me some examples or advice.
Now my project look's like this:
========= XAML ==========
<d3:ChartPlotter Name="plotter" Margin="20,20,20,70">
<d3:ChartPlotter.HorizontalAxis>
<d3:HorizontalDateTimeAxis Name="xAxis"/>
</d3:ChartPlotter.HorizontalAxis>
<d3:ChartPlotter.VerticalAxis>
<d3:VerticalIntegerAxis Name="yAxis"/>
</d3:ChartPlotter.VerticalAxis>
</d3:ChartPlotter>
<Button Content="Button" HorizontalAlignment="Left" Margin="254,364,0,0" VerticalAlignment="Top" Width="145" Height="46" Click="Button_Click_1"/>
</Grid>
=============================================
================ MainWindow.cs =================
private void Button_Click_1(object sender, RoutedEventArgs e)
{
List<DataForChart> dataForChart = new List<DataForChart>();
dataForChart.Add(new DataForChart(new DateTime(2013, 11, 03, 22, 10, 0), 45));
dataForChart.Add(new DataForChart(new DateTime(2013, 11, 03, 22, 20, 0), 48));
dataForChart.Add(new DataForChart(new DateTime(2013, 11, 03, 22, 30, 0), 24));
DateTime[] dates = new DateTime[dataForChart.Count];
int[] price = new int[dataForChart.Count];
for (int i = 0; i < dataForChart.Count; ++i)
{
dates[i] = dataForChart[i].date;
price[i] = dataForChart[i].price;
}
var datesDataSource = new EnumerableDataSource<DateTime>(dates);
datesDataSource.SetXMapping(x => xAxis.ConvertToDouble(x));
var numberOpenDataSource = new EnumerableDataSource<int>(price);
numberOpenDataSource.SetYMapping(y => y);
CompositeDataSource compositeDataSource1 = new
CompositeDataSource(datesDataSource, numberOpenDataSource);
plotter.AddLineGraph(compositeDataSource1,
new Pen(Brushes.Blue, 2),
new CirclePointMarker { Size = 10.0, Fill = Brushes.Blue },
new PenDescription("Price Chart"));
plotter.Viewport.FitToView();
}
public class DataForChart
{
public DateTime date;
public int price;
public DataForChart(DateTime Date, int Price)
{
date = Date;
price = Price;
}
}