简体   繁体   English

如何在C#图表控件中为不同系列设置不同的比例?

[英]How can I set different scales for different series in C# chart control?

What I want to accomplish is shown in the image below. 我要完成的工作如下图所示。 In that chart, I have three series, with the scales for each of them shown on the left side (maximum on the top, minimum on the bottom.) 在该图表中,我有三个系列,每个系列的比例都显示在左侧(最大值在顶部,最小值在底部)。

In the chart control, as far as I know, what I can do is set the properties Chart.ChartArea[0].AxisY.Minimum and Chart.ChartArea[0].AxisY.Maximum , but they are common to all series. 据我所知,在图表控件中,我可以做的是设置属性Chart.ChartArea[0].AxisY.MinimumChart.ChartArea[0].AxisY.Maximum ,但是它们对于所有系列都是通用的。

Is there any way that allows me to set different Minimum and Maximum values for each series, thus allowing me to have different scales for each of them? 有什么方法可以让我为每个系列设置不同的最小值和最大值,从而让我为每个系列设置不同的比例尺?

不同比例显示的不同系列

You may want to have a look on the "MultipleYAxis" sample of the "Samples for Chart Control" that can be downloaded here . 您可能想看看“图表控件的样本”的“ MultipleYAxis”样本,可以在此处下载。

The idea is to use two ChartArea per serie in the same chart control. 这个想法是在同一个图表控件中每个系列使用两个ChartArea。 Both contains the exact copy of each other points serie. 两者都包含彼此积分的精确副本。

  • The first one is aligned to left and shows only the Y Axis without the points 第一个向左对齐,仅显示Y轴,不带点
  • the seconds comes immediately to the right and shows only the points without the Y Axis. 秒数立即显示在右侧,并且仅显示没有Y轴的点。

Because you are using three series, you will have to use six ChartAreas. 因为您使用的是三个系列,所以必须使用六个ChartAreas。

It sounds a bit cumbersome and it requires some work to implement, but I did it in one of my project a dynamic way. 这听起来有点麻烦,并且需要执行一些工作,但是我在一个项目中以一种动态的方式完成了它。 It works very well and there is not that much performances penalty. 它工作得很好,并且没有太多的性能损失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有多个系列的C#图表,每个系列具有不同的x轴 - C# chart with multiple series, each with different x axis 如何在Winform C#中控制图表的缩放功能? - How I can control the Zoom ability of a chart in winform C#? 如何在图表上设置系列颜色? - How can I set the series color on a chart? C#-我们可以为每个堆叠的条形图设置不同的颜色吗? - C# - Can we set different color for each stacked of Stacked bar chart 如何以编程方式为c#中的资源文件中的value字段设置不同的字符串值? - How can I set a different string value for the value field in a resource file in c# programatically? 如何使用C#获取Excel中图表中系列总数的计数? - How can I get a count of the total number of series in a chart in excel using c#? 如何通过C#将控件大小设置为“自动”? - How can I set as “auto” a control size by C#? 如何以编程方式在SpreadsheetGear中设置图表系列的值? - How can I set the values of a chart series in SpreadsheetGear programmatically? 如何使用Epplus将两个具有不同类型图表的系列放置在控制图中? - How to put two series with different types of charts inside a control chart using Epplus? 是否可以从c#winforms中的两个不同数据集中匹配图表中的两个系列数据 - Is it possible to match two series of data in a chart from two different datasets in c# winforms
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM