This is a migrated thread and some comments may be shown as answers.

Line Chart changing colors unexpectedly

2 Answers 47 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 01 Dec 2011, 12:38 AM
We have a line chart that uses a stored procedure for data. There is a combo box that allows the user to select a different category, and to view the chart for that category. When the chart first loads, it has the expected line colors for the selected theme. When the combo box value is changed the chart reloads properly, but the line colors change. Here's the definition for the chart.
<telerik:RadChart ID="RadChartCategory" runat="server" DataSourceID="dsChartData" Width="950" Height="650" Skin="Vista">
        <PlotArea>
        <YAxis>
            <Appearance CustomFormat="#,#">
            </Appearance>
        </YAxis>
        <XAxis DataLabelsColumn="StringDate" LabelStep="4">
        </XAxis>
    </PlotArea>
    <Series>
        <telerik:ChartSeries DataYColumn="Scenario1" DefaultLabelValue="" Name="Scenario 1"
            Type="Line">
        </telerik:ChartSeries>
        <telerik:ChartSeries DataYColumn="Scenario2" DefaultLabelValue="" Name="Scenario 2"
            Type="Line">
        </telerik:ChartSeries>
        <telerik:ChartSeries DataYColumn="Scenario3" DefaultLabelValue="" Name="Scenario 3"
            Type="Line">
        </telerik:ChartSeries>
        <telerik:ChartSeries DataYColumn="Theoretical" DefaultLabelValue="" Name="Theoretical Capacity"
            Type="Line">
        </telerik:ChartSeries>
        <telerik:ChartSeries DataYColumn="NetEffective" DefaultLabelValue="" Name="Net Effective Capacity"
            Type="Line">
        </telerik:ChartSeries>
    </Series>
    <ChartTitle>
        <TextBlock Text="Labour Demand">
        </TextBlock>
    </ChartTitle>
</telerik:RadChart>

The only other code affecting the chart is to update the chart title when the selected value changes.
Protected Sub RadComboBoxCategory_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles RadComboBoxCategory.SelectedIndexChanged
    RadChartCategory.ChartTitle.TextBlock.Text = "Labour Demand - " & RadComboBoxCategory.SelectedItem.Text
End Sub

I've attached a before and after image of how the chart appears. This seems to occur with any Skin. Subsequent reloads keep the same colors as the first reload.

Any ideas?

2 Answers, 1 is accepted

Sort by
0
Accepted
Ves
Telerik team
answered on 05 Dec 2011, 02:37 PM
Hi Derek,

Indeed, the series appearance is lost in this scenario. Please, add SeriesPalette = "Vista" to chart's declaration. This will force the chart to use the Vista colors for series every time.

Best regards,
Ves
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Derek
Top achievements
Rank 1
answered on 05 Dec 2011, 02:57 PM
That works perfectly; thanks!
Tags
Chart (Obsolete)
Asked by
Derek
Top achievements
Rank 1
Answers by
Ves
Telerik team
Derek
Top achievements
Rank 1
Share this question
or