I need to draw line with many-coloured parts. For example, first ten points are red, second ten points are green and five points are black. How can I do that?
Alenka,
The only way to approach that currently would be to use a different series for each colored section. Which would, of course, only be appropriate if you don't have too many seperate colored sections. The DataChart doesn't currently support individual datapoint coloring for the line chart for performance reasons. You could individually color the markers though. If these suggestions don't solve your problem please collect your requirements and submit a feature request.
Hope this helps!
-Graham
Graham,
Thanks for your reply.
Individually color the markers may be interesting, but I thought the behavior of the markers is the same as that of the lines. Could you give me example how individually color the markers?
You can color the markers by providing a custom marker template, and binding to a brush on your data items. To sketch it out if you had xaml somewhat like this:
<DataTemplate x:key="coloredMarker">
<Rect Width="5" Height="5" Fill="{Binding Item.Color} />
</DataTemplate>
and then specify a custom marker for a series.
<LineSeries MarkerTemplate="{StaticResource coloredMarker"} ...
and if each one of your items had a property called Color of type Brush, then the marker would pull its color from the item, rather than using the series assigned color.
One thing to be aware of though, is that if you have a sufficiently large number of points in the series, there will not be a marker displayed for each and every point unless you zoom in.
Hi Graham,
is there also a way to color the lines between the markers?
Thanks!
Hello Gawain,
You can set the LinesSeries' Brush Property in order to color the Lines.
How can I do this depending on one value of the datapoints? I am using "series.ItemsSource".
I have created a sample project for you with the functionality you want. Basically I used Converter in the Brush’s Binding and this way I was able to iterate the DataPoints and return a particular Color on particular condition. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
After some research Different colors in LineSeries has been determine as a new Product Idea. I have sent your Product Idea directly to our product management team. Our product team chooses new Product Ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested ideas, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time. Your reference number for this Product Idea is PI12100175
If you would like to follow up on your Product Idea at a later point, you may contact Developer Support management via email. Please include the reference number of your Product Idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Hello Stefan,
sorry, but maybe I have not explained good enough what I want to achieve: I need to have a LineSeries where the lines between the datapoints have different colors depending on a datapoint value. I have seperated the Y-Axis into several parts.
Thanks for your help!
Gawain