WPF pie chart, column chart, line chart (2 line chart)

The line chart has been modified on the basis of the column chart. The approximate effect and usage are as follows.

 

The X-axis and Y-axis scales use the Figures property of Path to draw multiple Figure + LineSegment.

 

 

 

 At the same time, because the line chart is likely to draw multiple lines. So there will be some requirements for the data structure of Itemsource. Grouping and other operations should be done manually.

In actual use, I can't guarantee that the value passed by Itemsource is the same as the number of Chen Silly and Zhou Silan. The year is 2012-2018. If it is not the same, many complex situations need to be considered. Added the fixation of the year displayed on the X axis, as shown in the following list <string> of 2012-2018

 

 

 Since there is no fixed data format required by Itemsource, DisplayMemberMsg is used to imitate the play of Listbox. Grouping at the control level is actually more troublesome. Consider that you can do some visual virtual functions later. Let the controls use their own way to achieve grouped drawing titles, select discounted colors and other actions.

 

The words are pale. Looking directly at the code is more intuitive. https://gitee.com/csszbb/wpf_drawing  , if this program is helpful to you, please give me a compliment to my code cloud project, thank you.

If you have questions or needs, please contact me QQ 384347789

 

Guess you like

Origin www.cnblogs.com/CSSZBB/p/12744587.html