Change Series Color & Legend Position

Thread is closed for posting
2 posts, 0 answers
  1. Praveen Rustagi
    Praveen Rustagi avatar
    6 posts
    Member since:
    Feb 2009

    Posted 10 Oct 2009 Link to this post


    Dear Sir/Madam,

    I am adding series programmatically. I want to give "Red" color to first series & "Green" to second. and Series should display on top of chart.like

    1. Series_1      2. series_2  3. Series_3

    code to add series is as follows:

    // dtSource.Rows.Clear();

    chart.ChartTitle.TextBlock.Text =

    "Report Summary";

     

    crtSeries =

    new ChartSeries("Total");

     

    chart.AddChartSeries(crtSeries);

    crtSeries.Type =

    ChartSeriesType.Bar;

     

     

    //crtSeries.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;

     

     

    //crtSeries.Appearance.FillStyle.SecondColor = System.Drawing.Color.Red;

     

    crtSeries.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.

    StyleSeriesItemLabel.ItemLabelLocation.Auto;

     

    crtSeries =

    new ChartSeries("Pending");

     

    chart.AddChartSeries(crtSeries);

    crtSeries.Type =

    ChartSeriesType.Bar;

     

     

    //crtSeries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

     

     

    //crtSeries.Appearance.FillStyle.SecondColor = System.Drawing.Color.Green;

     

    crtSeries.Appearance.LabelAppearance.LabelLocation = Telerik.Charting.Styles.

    StyleSeriesItemLabel.ItemLabelLocation.Auto;


    please resolve ASAP..

     

  2. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 13 Oct 2009 Link to this post

    To give a series a color use the following code:
     
    mySeries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;  
    mySeries.Appearance.FillStyle.MainColor = Color.Orchid;  

    And then to display your legend at the top of the chart you should use:
     
    RadChart1.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Top;  

    If you want to add color to the font of the legend items you can do:
     
    RadChart1.Legend.Items[0].TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font("Arial", 15);  
    RadChart1.Legend.Items[0].TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.DarkGreen;  

Back to Top