Nevron Forum

2D points chart

https://www.nevron.com/Forum/Topic5006.aspx

By Anghshuman Chatterjee - Thursday, March 17, 2011

I require a 2D points chart which looks like the attached image. I am evaluating Nevron for achieving it. I am kind of overwhelmed by the number and types and variations of charts and all of them being in 3D ...

Could someone please confirm whether the kind of chart I am looking at is achievable with any component from Nevron? If yes, which installation package I need to use? I have requirements both for VC++ and WPF and I am on .Net 3.5 (Visual Studio 2008).

Also, I would like to know about the performance. The graphs are expected to handle ~1000-3000 points, which would be refreshed every 3-5 seconds, and the application would be displaying 3 to 10 of such graphs without being sluggish or unresponsive.

Thanks in advance.
By Nevron Support - Thursday, March 17, 2011

Hi Anghshuman,

You can easily create the attached chart by using crossed axes - in combination with secondary axes features. The following code snows how to create a simple xy scatter point chart where the secondary x and y axes are crossed at zero:

            NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

            // switch x axes to linear mode
            chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
            chart.Axis(StandardAxis.SecondaryX).ScaleConfigurator = new NLinearScaleConfigurator();

            // cross X and Y axes
           chart.Axis(StandardAxis.SecondaryX).Anchor = new NCrossAxisAnchor(AxisOrientation.Horizontal, new NValueAxisCrossing(chart.Axis(StandardAxis.PrimaryY), 0));
            chart.Axis(StandardAxis.SecondaryY).Anchor = new NCrossAxisAnchor(AxisOrientation.Vertical, new NValueAxisCrossing(chart.Axis(StandardAxis.PrimaryX), 0));

            // turn off labels for cross axes
            (chart.Axis(StandardAxis.SecondaryX).ScaleConfigurator as NLinearScaleConfigurator).AutoLabels = false;
            (chart.Axis(StandardAxis.SecondaryY).ScaleConfigurator as NLinearScaleConfigurator).AutoLabels = false;

            // show secondary axes
            chart.Axis(StandardAxis.SecondaryX).Visible = true;
            chart.Axis(StandardAxis.SecondaryY).Visible = true;
            chart.BoundsMode = BoundsMode.Fit;
            chart.Width = chart.Height = 50;

            // add some dummy data
            NPointSeries point = new NPointSeries();
            chart.Series.Add(point);
            point.DataLabelStyle.Visible = false;
            point.UseXValues = true;

            point.DisplayOnAxis((int)StandardAxis.SecondaryX, true);
            point.DisplayOnAxis((int)StandardAxis.SecondaryY, true);
            point.Size = new NLength(1);
            point.BorderStyle.Width = new NLength(0);
            point.ClusterMode = ClusterMode.Enabled;

            Random rand = new Random();

            for (int i = 0; i < 3000; i++)
            {
                point.Values.Add(rand.Next(200) - 100);
                point.XValues.Add(rand.Next(200) - 100);
            }

Hope this helps - lets us know if you meet any problems.