Plotting Circle


Author
Message
Syrhey Karol'
Syrhey Karol'
Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)
Group: Forum Members
Posts: 21, Visits: 74
Thank you! It works great!

Best regards,
Zonder

Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
It is possible to draw custom graphics (with GDI+) in the chart canvas. Please refer to the following examples in our Windows forms demo application:

All Examples > Custom Painting > ...
All Examples > Coordinate Transformations > ...

Best Regards,
Nevron Support Team


Syrhey Karol'
Syrhey Karol'
Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)Forum Member (27 reputation)
Group: Forum Members
Posts: 21, Visits: 74
Hi Guys!

Is it possible to draw simple shape like circle or rectangle with kind of 'NPathSeries' for now?
By the way NPath class was created for that goal?

Or I shall use the approach like in the previous post?
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Teddy,

You can use the GraphicsPath flatten method in a combination with a scatter line series to get a "circle"- for example:

private void Form1_Load(object sender, EventArgs e)
{
  NChart chart = nChartControl1.Charts[0];

  NLineSeries line = new NLineSeries();
  line.DataLabelStyle.Visible = false;

  using (GraphicsPath path = new GraphicsPath())
  {
    path.AddEllipse(new Rectangle(-10, -10, 20, 20));
    FillFromPath(line, path);
  }

  chart.Series.Add(line);
  chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

  nChartControl1.Refresh();
}

private void FillFromPath(NLineSeries line, GraphicsPath path)
{
  path.Flatten(null, 0.01f);
  PointF[] points = path.PathPoints;

  line.UseXValues = true;
  int count = points.Length;

  for (int i = 0; i < count; i++)
  {
    PointF point = points[i];
    line.Values.Add(point.X);
    line.XValues.Add(point.Y);
  }
}

We'll have a new series called path series in Vol2 (early autumn) that will allow you to draw graphics path directly in the control. Note that you may not actually get a circle if the plot proportions are not exactly 1:1.

Questions or comments - please feel free...



Best Regards,
Nevron Support Team


Teddy Lambropoulos
Teddy Lambropoulos
Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)
Group: Forum Members
Posts: 20, Visits: 1

Is there an easy way to plot a circle? I have tried using an NSmoothLineSeries for this, but the size of the data point markers makes the plot look "choppy." Is there an easier way to do this? Perhaps predefined shapes?

 

Best regards,

 

Teddy


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search