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

Change color of ChartSeries pointmarks

3 Answers 156 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
fudoki22
Top achievements
Rank 1
fudoki22 asked on 19 May 2011, 11:29 AM
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

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 24 May 2011, 10:38 AM
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.

0
fudoki22
Top achievements
Rank 1
answered on 06 Jun 2011, 03:11 PM
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
0
Ves
Telerik team
answered on 08 Jun 2011, 12:33 PM
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.

Tags
Chart (Obsolete)
Asked by
fudoki22
Top achievements
Rank 1
Answers by
Ves
Telerik team
fudoki22
Top achievements
Rank 1
Share this question
or