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

Can't seem to set color for the chart series item

1 Answer 57 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Seabus
Top achievements
Rank 1
Seabus asked on 14 Sep 2011, 01:45 AM
Hi ,

I can't set to set the chart series item for my telerik radchart.

Any ideas on what's wrong ?

MARKUP:
      <telerik:RadChart ID="chartLoyalty" runat="server" SkinsOverrideStyles="false" AutoLayout="true" >

                    <Appearance>
                        <Border Visible="false"></Border>
                        <FillStyle MainColor="White"></FillStyle>
                    </Appearance>   

                   

                   

                <PlotArea>
                        
                    
                    
                        <EmptySeriesMessage Visible="False">
                        </EmptySeriesMessage>


                            <XAxis>
                                    <Appearance Color="Black" Visible="true">
                                        <MajorGridLines Visible="false"></MajorGridLines>

                                        <TextAppearance TextProperties-Color="Black" TextProperties-Font="Arial,8pt">    
                                        </TextAppearance>

                                    </Appearance>

                                    <AxisLabel>
                                        <TextBlock>
                                                                <Appearance TextProperties-Color="Black"></Appearance>
                                        </TextBlock>
                                   </AxisLabel>
                            </XAxis>

                           <YAxis>
                                        <Appearance Color="White" Visible="true">
                                            <MajorGridLines Visible="false"></MajorGridLines>
                                            <MinorGridLines Visible="false"></MinorGridLines>
                                            <TextAppearance TextProperties-Color="Black">
                                            </TextAppearance>
                                        </Appearance>

                                            <AxisLabel>
                                            <TextBlock>
                                            <Appearance TextProperties-Color="Black"></Appearance>
                                            </TextBlock>
                                            </AxisLabel>
                            </YAxis>
    
                            <Appearance>    <FillStyle MainColor="White" FillType="Solid"></FillStyle>
                                    <Border Visible="false" />
                            </Appearance>
            </PlotArea>

   

        <ChartTitle Visible="false">
                <Appearance Visible="False">
                        <FillStyle MainColor=""></FillStyle>
                </Appearance>

        </ChartTitle>

               


</telerik:RadChart>

SOURCECODE:
        public void LoadChart(IList<CrowdMemberLoyaltyProjection> data)
        {



            chartLoyalty.Legend.Visible = false; // Remove the legend
            chartLoyalty.Series.RemoveSeries(); // Remove already existing series

            ChartSeries mySeries = new ChartSeries(String.Empty, ChartSeriesType.Bar);
            


            mySeries.DataYColumn = "PercentageDouble";
            mySeries.DataXColumn = "LoyaltyScore";
            

            chartLoyalty.PlotArea.YAxis.AutoScale = false;
            chartLoyalty.PlotArea.YAxis.MinValue = 0;
            chartLoyalty.PlotArea.YAxis.MaxValue = 100;
            chartLoyalty.PlotArea.YAxis.Step = 5;
            chartLoyalty.PlotArea.YAxis.Appearance.MajorTick.Visible = false;
            chartLoyalty.PlotArea.YAxis.Appearance.MinorTick.Visible = false;


            chartLoyalty.PlotArea.XAxis.LabelStep = 20;
            chartLoyalty.PlotArea.XAxis.AutoScale = false;
            chartLoyalty.PlotArea.XAxis.MinValue = 0;
            chartLoyalty.PlotArea.XAxis.MaxValue = 100;
            chartLoyalty.PlotArea.XAxis.Step = 0.5;
            

            chartLoyalty.PlotArea.XAxis.Appearance.MajorTick.Visible = false;
            chartLoyalty.PlotArea.XAxis.Appearance.MinorTick.Visible = false;


            chartLoyalty.Series.Add(mySeries);

            chartLoyalty.ItemDataBound += chartLoyalty_ItemDataBound;

            chartLoyalty.DataSource = data;
            chartLoyalty.DataBind();

           
        }

        protected void chartLoyalty_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
        {
             e.SeriesItem.Label.TextBlock.Visible = false;
             e.SeriesItem.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
             e.SeriesItem.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
             
        }

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 15 Sep 2011, 01:39 PM
Hello Sebastian,

Have you seen our help topic which describes how to assign custom colors on your series? The aproach is the same per series items.

Kind regards,
Evgenia
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Tags
Chart (Obsolete)
Asked by
Seabus
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or