This question is locked. New answers and comments are not allowed.
I found a bug with the chart where inserting a series makes all colors incorrect, I have create as simple an example as I could to replicate the problem.
The colors on the second chart are incorrect after swapping the series as it should be the same as Chart 3 - see attached image. The z-index is also incorrect.
The colors on the second chart are incorrect after swapping the series as it should be the same as Chart 3 - see attached image. The z-index is also incorrect.
<
StackPanel
>
<
TextBlock
Text
=
"Chart 1 - Initial"
/>
<
telerik:RadCartesianChart
x:Name
=
"Chart1"
Palette
=
"Metro"
Height
=
"100"
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:CategoricalAxis
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.VerticalAxis
>
</
telerik:RadCartesianChart
>
<
TextBlock
Text
=
"Chart 2 - Should be swapped (same as Chart 3)"
Margin
=
"0,10,0,0"
/>
<
telerik:RadCartesianChart
x:Name
=
"Chart2"
Palette
=
"Metro"
Height
=
"100"
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:CategoricalAxis
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.VerticalAxis
>
</
telerik:RadCartesianChart
>
<
TextBlock
Text
=
"Chart 3 - Expected"
Margin
=
"0,10,0,0"
/>
<
telerik:RadCartesianChart
x:Name
=
"Chart3"
Palette
=
"Metro"
Height
=
"100"
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:CategoricalAxis
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.VerticalAxis
>
</
telerik:RadCartesianChart
>
</
StackPanel
>
public
class
Data
{
public
int
Item {
get
;
set
; }
public
int
Value {
get
;
set
; }
}
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
// Add Line then Bar series to Chart 1
InsertSeries(Chart1,
true
, 0);
InsertSeries(Chart1,
false
, 1);
// Add Line then Bar series to Chart 2
InsertSeries(Chart2,
true
, 0);
InsertSeries(Chart2,
false
, 1);
// Remove Bar series, and re-insert to index 0 on Chart 2
RemoveLastSeries(Chart2);
InsertSeries(Chart2,
false
, 0);
// Add Bar then Line series to Chart 3 (should be the same as Chart 2)
InsertSeries(Chart3,
false
, 0);
InsertSeries(Chart3,
true
, 1);
}
private
void
InsertSeries(RadCartesianChart chart,
bool
isLine,
int
index)
{
CategoricalSeries series = isLine ? (CategoricalSeries)
new
LineSeries() :
new
BarSeries();
series.ItemsSource = GenerateData();
series.CategoryBinding =
new
PropertyNameDataPointBinding(
"Item"
);
series.ValueBinding =
new
PropertyNameDataPointBinding(
"Value"
);
chart.Series.Insert(index, series);
}
private
void
RemoveLastSeries(RadCartesianChart chart)
{
chart.Series.RemoveAt(chart.Series.Count - 1);
}
private
IEnumerable<Data> GenerateData()
{
for
(
int
i = 0; i < 5; ++i)
{
yield
return
new
Data()
{
Item = i,
Value = i
};
}
}
}