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

白昼怎懂夜的黑 提交于 2019-11-28 06:10:21

问题


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?


回答1:


You have a couple of options:

Use a different series for every point:

<lvc:CartesianChart>
   <lvc:CartesianChart.Series>
      <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




回答2:


1) Would it be possible that you fill the values of you ColumnSeries with 0's at the beginning? For example the values of the ColumnSeries will be like this, if you want to start your diagram from 7: {0, 0, 0, 0, 0, 0, 10, 12, 14, 16}

2) Could you give another example of a condition? Do you really mean x=10 or probably y=10? Is this Issue related to your question?



来源:https://stackoverflow.com/questions/45457336/column-series-with-different-color-on-a-different-interval-at-x-axis-fill-in-sam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!