Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

c# - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...