Hi Yuvaraj,
when I try your example everything works fine but when I try to use this in my project I get a "can't cast from source to target" exception.
My code looks like this:
NumericalAxis xAxis = new NumericalAxis
{
Title = new ChartAxisTitle{ Text = "Fortschritt" },
MajorTickStyle = new ChartAxisTickStyle{ TickSize = 0 },
EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift,
Interval = 1,
Minimum = 0,
Maximum = 9
};
xAxis.LabelCreated += onLabelCreated;
NumericalAxis yAxis = new NumericalAxis
{
Title = new ChartAxisTitle{ Text = "Erinnerung" },
//LabelStyle = new ChartAxisLabelStyle{ TextColor = Color.White },
MajorTickStyle = new ChartAxisTickStyle{ TickSize = 0 },
Interval = 1,
Minimum = 0,
Maximum = 8
};
diagram.PrimaryAxis = xAxis;
diagram.SecondaryAxis = yAxis;
var lineData = new ObservableCollection<ChartDataPoint>
{
new ChartDataPoint(0, 5),
new ChartDataPoint(8, 5)
};
LineSeries lineSeries = new LineSeries
{
ItemsSource = lineData,
StrokeWidth = 5,
Color = Color.Blue
};
diagram.Series.Add(lineSeries);
Without the LineSeries everything works.