首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用降采样功能放大/缩小图表

使用降采样功能放大/缩小图表
EN

Stack Overflow用户
提问于 2014-10-27 08:26:15
回答 1查看 601关注 0票数 1

我使用的是.NET Winform版本Teechart4.1.2014.8126评估版本。

当我使用降采样功能放大/缩小图表时,出现了问题。请看下面的图片。

这是一个使用下采样函数的图表。我们可以看到大约50 ~60个可见的标记点。

这是图表1的放大倍数。我们可以看到大约16 ~ 20个可见的标志点。

为什么当我放大时可见计数减少了?当我放大图表时,我想要更详细的视图。

代码语言:javascript
复制
  private void InitializeChart()
      {
            this.cursorTool1 = new Steema.TeeChart.Tools.CursorTool();//
            this.tChart1.Tools.Add(this.cursorTool1);//
            this.cursorTool1.FollowMouse = true;//
            this.cursorTool1.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;//
            this.cursorTool1.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(this.cursorTool1_Change);//

            CreateArrays();
            tChart1.Aspect.View3D = false;
            tChart1.Zoom.Direction = ZoomDirections.Both;//.Horizontal;//
            tChart1.Series.Add(points = new Steema.TeeChart.Styles.Points());
            tChart1.Series.Add(fastLine = new Steema.TeeChart.Styles.FastLine());

            downSampling = new Steema.TeeChart.Functions.DownSampling(tChart1.Chart);
            points.Add(xValues, yValues);
            points.Active = false;

            int pixelCount = 60;
            downSampling.DisplayedPointCount = pixelCount;
            downSampling.Method = Steema.TeeChart.Functions.DownSamplingMethod.MinMaxFirstLast;// Null;
            fastLine.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint;
            fastLine.DataSource = points;
            fastLine.Function = downSampling;

            this.tChart1.Axes.Custom.Add(new Steema.TeeChart.Axis(this.tChart1.Chart));//
            this.tChart1[1].CustomVertAxis = this.tChart1.Axes.Custom[0];//
            this.tChart1[0].CustomVertAxis = this.tChart1.Axes.Custom[0];//

            this.fastLine.Marks.Visible = true;//
        }

        private void CreateArrays()
        {
            int length = 100000;

            xValues = new Nullable<double>[length];
            yValues = new Nullable<double>[length];

            Random rnd = new Random();
            for (int i = 0; i < length; i++)
            {
              xValues[i] = i;
              yValues[i] = i;
            }
        }

        private void tChart1_Zoomed(object sender, EventArgs e)
        {
            tChart1[1].CheckDataSource(); //series 1 is the function series
        }
EN

回答 1

Stack Overflow用户

发布于 2014-10-29 01:19:45

这不是缺陷,而是意料之中的行为。如果我们将以下代码添加到您的示例中(带有相关的事件声明):

代码语言:javascript
复制
void tChart1_AfterDraw(object sender, Graphics3D g)
{
  string s = "Count: " + tChart1[1].Count.ToString() + Utils.NewLine
    + "Displayed Count: " + (tChart1[1].LastVisibleIndex - tChart1[1].FirstVisibleIndex).ToString();
  tChart1.Header.Text = s;
}

我们可以看到,"Count“是您在变量"pixelCount”中定义的,"Displayed Count“随着底轴最大值和最小值的靠近而减小。

我认为你期望“显示的计数”随着底部轴的最大值和最小值越来越近而增加,但只要序列“计数”保持不变,这种情况就不会发生。要在缩放时增加系列的“计数”,您必须增加"pixelCount“的值并重新计算。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26579564

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档