Hi!
Working with radchart I face with the problem that after I refresh the page (on which is my chart) it's Y axis is strange.
My XAML:
Code-behind (declared in the constructor):
My binded OC for feeding the chart:
My refresh function does nothing more than clear the OC and rewrite the data for feed my chart:
Thanks for all your replies.
Luka
Working with radchart I face with the problem that after I refresh the page (on which is my chart) it's Y axis is strange.
My XAML:
<
telerik:RadChart
x:Name
=
"durationChart"
ItemsSource
=
"{Binding DurationChart, Mode=TwoWay}"
>
<
telerik:RadChart.SeriesMappings
>
<
telerik:SeriesMapping
LegendLabel
=
"Devices"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:BarSeriesDefinition
></
telerik:BarSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
DataPointMember
=
"Label"
FieldName
=
"Value"
></
telerik:ItemMapping
>
<
telerik:ItemMapping
DataPointMember
=
"YValue"
FieldName
=
"Value"
></
telerik:ItemMapping
>
<
telerik:ItemMapping
DataPointMember
=
"XCategory"
FieldName
=
"Label"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
</
telerik:RadChart.SeriesMappings
>
</
telerik:RadChart
>
Code-behind (declared in the constructor):
#region Duration Chart
// Hide legend
durationChart.DefaultView.ChartLegend.Visibility = Visibility.Collapsed;
// Axis titles
durationChart.DefaultView.ChartArea.AxisX.Title = MOD_COM_HLP.LocalizationHelper.LocalizeString(ResourceKeys.DLYPlantDelaysDurationXAxisResourceKey);
durationChart.DefaultView.ChartArea.AxisY.Title = MOD_COM_HLP.LocalizationHelper.LocalizeString(ResourceKeys.DLYPlantDelaysDurationYAxisResourceKey);
// X axis
durationChart.DefaultView.ChartArea.AxisX.AxisLabelsVisibility = Visibility.Visible;
durationChart.DefaultView.ChartArea.AxisX.PlotAreaAxisLabelsVisibility = Visibility.Visible;
// Y axis
durationChart.DefaultView.ChartArea.AxisY.AxisLabelsVisibility = Visibility.Visible;
durationChart.DefaultView.ChartArea.AxisY.MajorTicksVisibility = Visibility.Visible;
durationChart.DefaultView.ChartArea.AxisY.MinorTicksVisibility = Visibility.Hidden;
#endregion
My binded OC for feeding the chart:
ObservableCollection<DLYChartPoint> durationChart =
new
ObservableCollection<DLYChartPoint>();
My refresh function does nothing more than clear the OC and rewrite the data for feed my chart:
private
void
FillDurationChart()
{
// Aux values
List<LPD_COM_ENT.AUXValue> dlyDurationChartPeriods = lPDModulesLibraryProxy.ReadAUXValues(
new
LPDModulesLibrary.Common.Entities.ReadFilter() { VariableName =
"DLY_DURATION_CHART_PERIOD"
});
if
(Items ==
null
)
return
;
// Clear the chart
DurationChart.Clear();
// Add the columns
foreach
(LPD_COM_ENT.AUXValue variable
in
dlyDurationChartPeriods) {
DLYChartPoint point =
new
DLYChartPoint() {Label = variable.CharValue, Value=0, UniqueId=variable.ValueSeq };
DurationChart.Add(point);
}
// Fill chart
foreach
(DLYDelay stoppage
in
Items)
{
double
duration = (stoppage.EndDelay - stoppage.StartDelay).TotalSeconds;
foreach
(LPD_COM_ENT.AUXValue variable
in
dlyDurationChartPeriods) {
if
(duration >= variable.IntegerValue && duration < variable.FloatValue) {
DurationChart[(
int
)variable.ValueSeq].Value++;
}
}
}
}
Thanks for all your replies.
Luka