public void Create3DScatterChart(WinChartViewer viewer, string title, List<Point> plot, int width, int height)
{
 try
 {
  ThreeDScatterChart c = new ThreeDScatterChart(width, height);
  c.addTitle(title, "Times New Roman Italic", 10);
  c.setPlotRegion(width / 2 - 10, height / 2 - 15, width / 2, width / 2, height / 2 - 10);
  c.setViewAngle(15, 30);
  c.addLegend(width - 60, height - 180);
  double[] xData=new double[plots.Count];
  double[] yData=new double[plots.Count];
  double[] zData=new double[plots.Count];
  for(int i=0; i < plot.Count; ++i)
  {
   xData[i] = plot[i].X;
   yData[i] = plot[i].Y;
   zData[i] = plot[i].Z;
  }
  ThreeDScatterGroup g = c.addScatterGroup(xData, yData, zData, 
    "Legend1",
    ChartDirector.Chart.GlassSphere2Shape, 13, 
    0xFF0000);
  g.setLegendIcon(15, 15, 0xFF0000);
  // Set the x, y and z axis titles using 10 points Arial Bold font
  c.xAxis().setTitle("X", "Arial Bold", 10);
  c.yAxis().setTitle("Y", "Arial Bold", 10);
  c.zAxis().setTitle("Z", "Arial Bold", 10);
  // Output the chart
  viewer.Chart = c;
  //include tool tip for the chart
  viewer.ImageMap = c.getHTMLImageMap("clickable", "", "title='(X={x|p}, Y={y|p}, Z={z|p})'");
 }
 catch
 {
 }
}
To instead save the scatter 3d plot to a file, use the following code:
  
 
To instead save the scatter 3d plot to a file, use the following code:
public void Create3DScatterChart(string filename, string title, List<Point> plot, int width, int height)
{
 try
 {
  ThreeDScatterChart c = new ThreeDScatterChart(width, height);
  c.addTitle(title, "Times New Roman Italic", 10);
  c.setPlotRegion(width / 2 - 10, height / 2 - 15, width / 2, width / 2, height / 2 - 10);
  c.setViewAngle(15, 30);
  c.addLegend(width - 60, height - 180);
  double[] xData=new double[plots.Count];
  double[] yData=new double[plots.Count];
  double[] zData=new double[plots.Count];
  for(int i=0; i < plot.Count; ++i)
  {
   xData[i] = plot[i].X;
   yData[i] = plot[i].Y;
   zData[i] = plot[i].Z;
  }
  ThreeDScatterGroup g = c.addScatterGroup(xData, yData, zData, 
    "Legend1",
    ChartDirector.Chart.GlassSphere2Shape, 13, 
    0xFF0000);
  g.setLegendIcon(15, 15, 0xFF0000);
  // Set the x, y and z axis titles using 10 points Arial Bold font
  c.xAxis().setTitle("X", "Arial Bold", 10);
  c.yAxis().setTitle("Y", "Arial Bold", 10);
  c.zAxis().setTitle("Z", "Arial Bold", 10);
  // Output the chart
  using(Image img=c.makeImage())
{
img.Save(filename);
}
{
img.Save(filename);
}
 }
 catch
 {
 }
}
This is great, but are you aware of any solutions that don't involve paid software?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteIf you are wondering what a scatter plot shows, the answer is simpler than you think. The scatter plot also has other names, such as a scatter plot, scatter plot, and correlation plot.
ReplyDeletehttps://ppcexpo.com/blog/scatter-plot-examples