.net基于数据量的图表宽度

时间:2013-05-01 13:38:31

标签: c# .net charts width data-visualization

我正在使用System.Windows.Forms.DataVisualization.Charting来虚拟化波形数据。显然它是成千上万的值,但我想只显示第一个图形1022值和本例中的第二个770值。结果如下图所示:

enter image description here

我的问题是两个图表都有固定的宽度,数据被推到那个宽度,无论它们有多少。当您将标签页从“强度”交换为“强度调整”并且轴X上的点200位于其他位置时,这看起来很难看。

我的标签页有autoscroll = true,所以我想将两个图表向右拉伸并水平滚动它们。我试过了

chartIntensity.Width = (intensitySound.Length);

其中chartIntensity是Chart,intensitySound是值数组,但它太简单了。图表被拉伸但一切都在移动,here就是这样的结果。 Y标签较大,chartArea似乎向右移动,X上的值不合适。 我想我应该设置chartArea的宽度,但它只能设置为百分比。也许有一些隐藏的公式来定义数据量和chart.width之间的关系,但我找不到它。

我希望我很清楚,对不起我的英语,如果你想我可以创造一些最小的例子,但我认为这是一个相当普遍的问题。 请帮忙,我需要漂亮的图表: - )

这是其中一个图表的定义:

        // chartIntensity
        // 
        chartArea1.AxisX.ScaleView.SizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Number;
        chartArea1.AxisX.ScaleView.Zoomable = false;
        chartArea1.AxisY.Maximum = 32767D;
        chartArea1.AxisY.Minimum = -32768D;
        chartArea1.CursorX.IsUserEnabled = true;
        chartArea1.Name = "ChartArea1";
        this.chartIntensity.ChartAreas.Add(chartArea1);
        this.chartIntensity.Dock = System.Windows.Forms.DockStyle.Left;
        legend1.Name = "Legend1";
        this.chartIntensity.Legends.Add(legend1);
        this.chartIntensity.Location = new System.Drawing.Point(3, 3);
        this.chartIntensity.Name = "chartIntensity";
        series1.ChartArea = "ChartArea1";
        series1.CustomProperties = "PixelPointWidth=1, DrawSideBySide=False, EmptyPointValue=Zero, PointWidth=1, MinP" +
"ixelPointWidth=1, MaxPixelPointWidth=1";
        series1.Legend = "Legend1";
        series1.Name = "Series1";
        series1.SmartLabelStyle.Enabled = false;
        this.chartIntensity.Series.Add(series1);
        this.chartIntensity.Size = new System.Drawing.Size(871, 170);
        this.chartIntensity.TabIndex = 0;
        this.chartIntensity.Text = "chart1";

0 个答案:

没有答案