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

Change Color of LineSeries

1 Answer 292 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
KA
Top achievements
Rank 1
KA asked on 22 Mar 2015, 12:38 AM
Hi,

in my project I have a ChartView with up to 5 different LineSeries (loaded dynamically). Now I would like to change the stroke of each LineSeries with the RadColorPicker. Also the LegendItemColor and the AxisColor should change accordingly. Is there a built-in solution for this?

If not can you give me a little hint which would be the best way to implement this functionality.

Thank you very much
KA

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar Marchev
Telerik team
answered on 23 Mar 2015, 09:24 AM
Hello KA,

Essentially, the colors of the legend markers are obtained automatically. Whenever the stroke of the line (representing the line series) changes, the legend marker should automatically get updated. In order to change the stroke of the line, you can chose from 3 different approaches:
1. Setting the Stroke property of the LineSeries directly.
2. Using a chart palette.
3. Using the StrokeShapeStyle property of the series to pass a style targetting a Path and using a Setter for the Stroke property.

The second and third option may be a little inconvenient in your case so I think that using the Stroke property of the LineSeries is the easiest way to go.

As for the axes - you can style the axes in more than one way. If you need the same color to be applied to the labels, ticks and axis line, you can use the ElementBrush property of the axis. If you need different colors for the different elements you can use the LabelStyle, MajorTickStyle and LineStroke properties of the axis.

I hope this information helps. Let us know how it goes.

Regards,
Petar Marchev
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
ChartView
Asked by
KA
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or