Change color of ChartSeries pointmarks

Thread is closed for posting
4 posts, 0 answers
  1. fudoki22
    fudoki22 avatar
    8 posts
    Member since:
    Jun 2009

    Posted 19 May 2011 Link to this post

    I'm creating 8 series in my chart - 4 lines, 4 points, one point series for each line. Data is displaying fine. I have used the Hay skin but have opted to change the color of one of my lines. However, I can't seem to get the pointmarks in the point series to change color.

    I'm creating my series as follows:-

    protected RadChart SetChartData(RadChart radChart, DataTable chartDataTable)
            {
                radChart.DataSource = chartDataTable;
                
                radChart.Series.Add(CreateChartSeries("Assets", ChartSeriesType.Line, "Assets"));
                radChart.Series[0].Appearance.LabelAppearance.Visible = false;
     
                radChart.Series.Add(CreateChartSeries("Assets calibrations", ChartSeriesType.Point, Color.Red, "AssetCalibrations"));
                //radChart.Series[1].Appearance.PointMark.FillStyle.MainColor = System.Drawing.Color.Red;
                radChart.Series[1].Appearance.LabelAppearance.Visible = false;
     and so forth for the other 6 series
                return radChart;
            }
     
    which calls my CreateChartSeries method:-
     
    protected ChartSeries CreateChartSeries(string name, ChartSeriesType type, Color seriesColor, string dataYColumn)
            {
                ChartSeries chartSeries = new ChartSeries();
                chartSeries.Name = name;
                chartSeries.Type = type;
                if (type == Telerik.Charting.ChartSeriesType.Line) { chartSeries.Appearance.LineSeriesAppearance.Color = seriesColor; }
                if (type == Telerik.Charting.ChartSeriesType.Point) { chartSeries.Appearance.PointMark.FillStyle.MainColor = seriesColor; }
     
                chartSeries.DataYColumn = dataYColumn;
     
                return chartSeries;
            }

    I know my code is stepping into the 2nd if (type==Point) and it appears to set the color, but when my chart is rendered, the points are all colored by the Hay skin. I've even tried setting the color after the series.add (commented out now in my SetChartData method.

    Hopefully I'm doing something daft?
    thanks
    --Michael

  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 24 May 2011 Link to this post

    Hi Michael,

    The Series.Appearance.PointMark properties are intended to define the appearance of the PointMarks of line/spline series (you can see them in this example). You can set the fill color for Point series as it is done for bars:

    MyChart.Series[0].Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
    MyChart.Series[0].Appearance.FillStyle.MainColor = Color.Red;


    Best regards,
    Ves
    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
  4. fudoki22
    fudoki22 avatar
    8 posts
    Member since:
    Jun 2009

    Posted 06 Jun 2011 Link to this post

    Hi Ves,

    Thanks for you response and apologies for the slow reply (paternity leave for me). Your solution worked nicely - not sure why I didn't try that before blundering into the pointmark properties. I put it down to pre-baby nerves :)

    Regards
    --Michael
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 08 Jun 2011 Link to this post

    Hey Michael,

    Great news. Congratulations on behalf of the Telerik team. Having the chart working as needed -- that's good too.

    Greetings,
    Ves
    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.

Back to Top