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

Modify color of PointSeries in code?

2 Answers 208 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 04 Feb 2015, 02:08 AM
I am charting multiple PointSeries.  I am creating each PointSeries in code.  How do you control the color of each PointSeries?

Code:
var chartViewModel = Grid.DataContext as ChartViewModel;
 
var pointSeries = new PointSeries
{
    ItemsSource = chartViewModel.DataPoints,
    CategoryBinding = new PropertyNameDataPointBinding("DateTime"),
    ValueBinding = new PropertyNameDataPointBinding("Point"),
    PointSize = new Size(3, 3)
};
 
Chart.Series.Add(pointSeries);

XAML:
<telerik:RadCartesianChart x:Name="Chart">
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:LinearAxis LineThickness="1"
                            MajorTickLength="5"
                            TickThickness="1"/>
    </telerik:RadCartesianChart.VerticalAxis>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:DateTimeCategoricalAxis DateTimeComponent="Minute"
                                         LabelFormat="M/d H:mm"
                                         LineThickness="1"
                                         MajorTickInterval="60"
                                         MajorTickLength="5"
                                         TickThickness="1"/>
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.Grid>
        <telerik:CartesianChartGrid MajorLinesVisibility="XY" />
    </telerik:RadCartesianChart.Grid>
</telerik:RadCartesianChart>

Thanks in advance!

2 Answers, 1 is accepted

Sort by
0
Kyle
Top achievements
Rank 1
answered on 04 Feb 2015, 02:56 PM
Better yet, is there a way to just randomly assign colors to multiple series?
0
Pavel R. Pavlov
Telerik team
answered on 06 Feb 2015, 10:01 AM
Hi Kyle,

You can check our documentation to see how the color of the series can be changed. I hope this information will get you started.

Please do not hesitate to ask if you need any further assistance.

Regards,
Pavel R. Pavlov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
Kyle
Top achievements
Rank 1
Answers by
Kyle
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or