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

Thread is closed for posting
2 posts, 0 answers
  1. Seabus
    Seabus avatar
    33 posts
    Member since:
    Jun 2011

    Posted 13 Sep 2011 Link to this post

    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;
                 
            }

  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 15 Sep 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top