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

Change background color of each Bar

0 Answers 100 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 19 Jan 2017, 09:06 PM

I am trying to change the background colors of individual bars to red and green

TryCast(RadHtmlChart1.PlotArea.Series(0), BarSeries).SeriesItems(0).BackgroundColor = System.Drawing.Color.Red.

Chart works great and I am binding to a datatable

RadHtmlChart1.DataSource = DifferenceDT
RadHtmlChart1.DataBind()

 

The error is on SeriesItems (Out of Range) and count is 0 when I inspect. 

Am I  doing something wrong?

Here is my .aspx code

<telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" Style="width: 100%; height: 98%;">
    <PlotArea>
        <Series>
            <telerik:BarSeries DataFieldY="Count" Name="Count" >
                <LabelsAppearance>
                    <TextStyle Color="White" />
                </LabelsAppearance>
            </telerik:BarSeries>
        </Series>
        <XAxis DataLabelsField="Name"  >
            <LabelsAppearance>
                <TextStyle Color="White" />
            </LabelsAppearance>
            <MinorGridLines Visible="false" />
        </XAxis>
        <YAxis AxisCrossingValue="0" Step="1"  >
            <MinorGridLines Visible="false" />
            <LabelsAppearance>
                <TextStyle Color="Blue" />
            </LabelsAppearance>
        </YAxis>
    </PlotArea>
</telerik:RadHtmlChart>

No answers yet. Maybe you can help?

Tags
Chart (HTML5)
Asked by
Charles
Top achievements
Rank 1
Share this question
or