Hi there
The situation is the following:
I am in need of having custom ticks on the X-axis in the form of DateTimes, jeg AutoRange doesnt seem to be working for me when i have ticks with same date but different time of day.
I have tried setting AutoRange to false, and creating ticks my self but this gives me no graphs at all, can someone tell me what I am missing here?
Following is from my code-behind:
The situation is the following:
I am in need of having custom ticks on the X-axis in the form of DateTimes, jeg AutoRange doesnt seem to be working for me when i have ticks with same date but different time of day.
I have tried setting AutoRange to false, and creating ticks my self but this gives me no graphs at all, can someone tell me what I am missing here?
Following is from my code-behind:
private
void
SetupGraph()
{
radChart.ItemsSource = dataContext.Points;
var seriesMappings = CreateSeriesMappings();
var axisX =
new
AxisX
{
DefaultLabelFormat =
"dd-MM-yy"
,
LabelRotationAngle = 45,
Step = 1,
LabelStep = 1,
AutoRange =
false
,
IsDateTime =
true
};
var tickPoints = dataContext.Points.SelectMany(gp => gp).Select(gp => gp.Date).Distinct().Select(dt =>
new
TickPoint(){IsDateTime =
true
, Label = dt.ToShortDateString(), Value = dt.ToOADate()});
axisX.TickPoints.AddRange(tickPoints);
var axisY =
new
AxisY { DefaultLabelFormat =
"N3"
, };
var chartArea =
new
ChartArea { AxisX = axisX, AxisY = axisY, LegendName =
"legend"
};
var chartLegend =
new
ChartLegend { Name =
"legend"
, UseAutoGeneratedItems =
true
, Width = 145 };
var chartTitle =
new
ChartTitle { Content =
"Graph"
};
var chartDefaultView =
new
ChartDefaultView
{
ChartArea = chartArea,
ChartTitle = chartTitle,
ChartLegend = chartLegend,
};
radChart.SeriesMappings.AddRange(seriesMappings);
radChart.DefaultView = chartDefaultView;
radChart.AnimationSettings =
new
AnimationSettings() { TotalSeriesAnimationDuration =
new
TimeSpan(0, 0, 0, 00), ItemAnimationDuration =
new
TimeSpan(0,0,0,0), ItemDelay =
new
TimeSpan(0,0,0,0)};
radChart.Rebind();
}