1

I use a .NET Winform version teechart 4.1.2014.8126 evalution version.

When I zoom in / out chart using downsampling function, Something is wrong. Look at the below picture.

This is a chart using downsampling function. We can see about 50 ~60 visible mark point.

This is a zoom in chart 1 time. We can see about 16 ~ 20 visible mark point.

Why visible count is decrease when I zoom in? I want more detail view, when I zoom in chart.

  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
        }
  • You need to describe *what* is wrong. I can't see an error on that picture. The code generating it will also be important for someone trying to help you. – BradleyDotNET Oct 27 '14 at 00:28
  • @BradleyDotNET First pic, Displayed Count is about 50 ~ 60. And then when Zoom in 1 time, Visible Count is about 16 ~ 20 at second pic. Is it correct? I don't think so. If we zoom in chart, visible point muse be same previous. And my code is changed by me from teechart sample code. And I said "Why displayed count is decrease?" --> This is my question – DugSung Kim Oct 27 '14 at 00:59
  • I don't understand. You asked this question before on 29/09/2014 but have since deleted it (it was here http://stackoverflow.com/questions/26090888/zoom-in-downsampling-teechart) Why are you asking the same question again having already received a number of pertinent answers and comments? – Christopher Ireland Oct 28 '14 at 11:14
  • @Christopher Ireland I also can not understand. Do you ask me after to read another question that I wrote? (stackoverflow.com/questions/26054996/…; Look at the sixth and eighth comments. And then You will know why I am asking again.And if you read above my question and picture correctly, you know why I read again. – DugSung Kim Oct 28 '14 at 15:31
  • http://stackoverflow.com/questions/26054996/zoom-in-downsampling-chart/26120807?noredirect=1#comment41153578_26120807 – DugSung Kim Oct 28 '14 at 16:04

1 Answers1

1

This is not a defect, but expected behaviour. If we add the following code to your example (with the relevant event declaration):

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;
}

We can see that "Count" is what you have defined in your variable "pixelCount" and "Displayed Count" decreases as the bottom axis maximum and minimum move closer together.

I think you are expecting the "Displayed Count" to increase as the bottom axis maximum and minimum move closer together, but this is not going to happen as long as the series "Count" remains the same. To increase the series "Count" on zooming you will have to increase the value of "pixelCount" and recalculate.

  • Yes I think so. But when I increase pixelCount as tChart[0].Axes.Bottom.IAxisSize, nothing changed. I added that Zoomed event function. How can I do it correctly? And Where is the correct position to add a code? And If I increase "pixelCount" in the chart that is So many data about 1,000,000 is binding, performance will be not so good. What is the best solution in this case? Please Help me. – DugSung Kim Oct 29 '14 at 01:15
  • You can keep the "Displayed Count" constant like this: private void tChart1_Zoomed(object sender, EventArgs e) { downSampling.DisplayedPointCount = CalcDisplayedPointCount(); tChart1[1].CheckDataSource(); //series 1 is the function series } private int CalcDisplayedPointCount() { return Utils.Round((pixelCount / (tChart1.Axes.Bottom.Maximum - tChart1.Axes.Bottom.Minimum)) * 100000); } – Christopher Ireland Oct 30 '14 at 09:36
  • What is the meaning of 100000? Is this points's count or fastLine's count? FastLine means visible series. Points means original source series. – DugSung Kim Oct 31 '14 at 00:52
  • int length = 100000; <-- this is the meaning of 100000. – Christopher Ireland Oct 31 '14 at 09:04