title: Can we create 3D graph in 4 quadrants in C#.NET winform?
body: <p>I want to create a 3D Graph in 4 quadrants form in C#.NET. For instant, I could do as shown below. If you see the corner of the chart begins with (-150, -200). I wish to start with (0,0) and the extend into 4 quadrant form.</p>
  
  <p><a href="https://i.stack.imgur.com/h3Zjw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h3Zjw.png" alt="enter image description here"></a></p>
  
  <p>Kindly enlighten me how can I transform this 3D graph in 4 quadrant form ?</p>
  
  <p>Below is the corresponding code:</p>
  
  <pre><code>void prepare3dChart(Chart chart, ChartArea ca)
      {
          ca.Area3DStyle.Enable3D = true;  
          Series s = new Series();
          chart.Series.Add(s);
          s.ChartType = SeriesChartType.Bubble;  
          s.MarkerStyle = MarkerStyle.Diamond;
          s["PixelPointWidth"] = "100";
          s["PixelPointGapDepth"] = "1";
  
          chart.ApplyPaletteColors();
  
          addTestData(chart);
      }
      void addTestData(Chart chart)
      {
          Random rnd = new Random(9);
          double x = 0, y = 0, z = 0;
          for (int i = 0; i &lt; 100; i++)
          {
              AddXY3d(chart.Series[0], x, y, z);          
              x = Math.Sin(i / 11f) * 88 + rnd.Next(3);
              y = Math.Cos(i / 10f) * 88 + rnd.Next(5);
              z = (Math.Sqrt(i * 2f) * 88 + rnd.Next(6));
          }
      }
      int AddXY3d(Series s, double xVal, double yVal, double zVal)
      {
          int p = s.Points.AddXY(xVal, yVal, zVal);           
          s.Points[p].Color = Color.Transparent;
          return p;
      }
      private void chart1_PostPaint(object sender, ChartPaintEventArgs e)
      {
          Chart chart = sender as Chart;
  
          if (chart.Series.Count &lt; 1) return;
          if (chart.Series[0].Points.Count &lt; 1) return;
  
          ChartArea ca = chart.ChartAreas[0];
  
          List&lt;List&lt;PointF&gt;&gt; data = new List&lt;List&lt;PointF&gt;&gt;();
          foreach (Series s in chart.Series)
              data.Add(GetPointsFrom3D(ca, s, s.Points.ToList(), e.ChartGraphics));
  
          renderLines(data, e.ChartGraphics.Graphics, chart, true);  
          renderPoints(data, e.ChartGraphics.Graphics, chart, 6);  
      }
      List&lt;PointF&gt; GetPointsFrom3D(ChartArea ca, Series s,
                           List&lt;DataPoint&gt; dPoints, ChartGraphics cg)
      {
          var p3t = dPoints.Select(x =&gt; new Point3D((float)ca.AxisX.ValueToPosition(x.XValue),
              (float)ca.AxisY.ValueToPosition(x.YValues[0]),
              (float)ca.AxisY.ValueToPosition(x.YValues[1]))).ToArray();
          ca.TransformPoints(p3t.ToArray());
  
          return p3t.Select(x =&gt; cg.GetAbsolutePoint(new PointF(x.X, x.Y))).ToList();
      }
      void renderLines(List&lt;List&lt;PointF&gt;&gt; data, Graphics graphics, Chart chart, bool curves)
      {
          for (int i = 0; i &lt; chart.Series.Count; i++)
          {
              if (data[i].Count &gt; 1)
                  using (Pen pen = new Pen(Color.FromArgb(64, chart.Series[i].Color), 2.5f))
                      if (curves) graphics.DrawCurve(pen, data[i].ToArray());
                      else graphics.DrawLines(pen, data[i].ToArray());
          }
      }
  
      void renderPoints(List&lt;List&lt;PointF&gt;&gt; data, Graphics graphics, Chart chart, float width)
      {
          for (int s = 0; s &lt; chart.Series.Count; s++)
          {
              Series S = chart.Series[s];
              for (int p = 0; p &lt; S.Points.Count; p++)
                  using (SolidBrush brush = new SolidBrush(Color.FromArgb(64, S.Color)))
                      graphics.FillEllipse(brush, data[s][p].X - width / 2,
                                           data[s][p].Y - width / 2, width, width);
          }
      }
  </code></pre>
  
  <p>I want my 3D graph to have 4 quadrants like this:
  <a href="https://i.stack.imgur.com/D2HKr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D2HKr.png" alt="enter image description here"></a></p>
  
  <p>Thanks @TaW. I got the code right.</p>
  
  <pre><code>   void prepare3dChart(Chart chart, ChartArea ca)
      {
          ca.Area3DStyle.Enable3D = true;
          ca.BackColor = Color.Transparent;
  
          ca.AxisX.Minimum = -300;
          ca.AxisX.Maximum = 300;
          ca.AxisY.Minimum = -300;
          ca.AxisY.Maximum = 300;
  
          ca.AxisX.Crossing = 0;  // move both axes..
          ca.AxisY.Crossing = 0;  // to the middle
  
          ca.AxisX.Interval = 50;
          ca.AxisY.Interval = 50;
  
          ca.AxisX.MajorGrid.LineColor = Color.LightGray;
          ca.AxisY.MajorGrid.LineColor = Color.LightGray;
  
          chart.Series.Clear();
          Series s = new Series();
          chart.Series.Add(s);
          s.ChartType = SeriesChartType.Bubble;  
          s.MarkerStyle = MarkerStyle.Diamond;
          s["PixelPointWidth"] = "100";
          s["PixelPointGapDepth"] = "1";
  
          chart.ApplyPaletteColors();
  
          addTestData(chart);
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Tcud5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tcud5.png" alt="enter image description here"></a></p>