tb1110 tb1110 - 1 year ago 56
C# Question

Column Series With different color on a different interval at x-axis fill in same series?

I'm trying to implement a speed/time plot UI, i'm using WPF with the MVVM Pattern and Live-Charts by beto-rodriguez as my plot library.
I am using Column Series.

i have two issues:
1) i have to start the series in middle of the x-axis how to do this? e.g if i set the min value as 7 the graph starts the x axis as 7 taking it the first point but i want x - axis to start at 1 but graph plotting should start at 7.

2) i have to change the color of the series at a certain condition say when x= 10 i want it to be shown as blue but when x= 17 i want to show the same series as pink only for that value rest at all points it should be of the original color.

Any Pointers?

Answer Source

You have a couple of options:

Use a different series for every point:

      <lvc:ColumnSeries Fill="Red" />
      <lvc:ColumnSeries Fill="Blue" />

You can use set them using a mapper, for example: https://lvcharts.net/App/examples/v1/wpf/Point%20State

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download