12,398,000 members (49,446 online)
Rate this:
See more:
I am trying to show four quadrants in a Cartesian chart .Please guide how can i use the standard chart control to make a Cartesian chart.
my input values are like { (5,10 ) , ( 15, - 4 ) , ( -20, - 9 ), ( -10,14) } ,
Posted 18-May-13 5:14am
Updated 19-May-13 17:53pm
v2
Idle_Force 18-May-13 12:02pm

Show us some relevant code.
Sergey Alexandrovich Kryukov 18-May-13 22:15pm

There are only two coordinates in 2D. What are you talking about? Maybe you simply misuse the terminology, but how can you expect others to understand you?
—SA
Sergey Alexandrovich Kryukov 18-May-13 22:19pm

—SA
muneebalikiyani 24-Jun-13 0:05am

lol...
TnTinMn 19-May-13 2:11am

Do you mean "show all four quadrants in a Cartesian chart" as opposed to "show all four coordinates ( xy, x-y, -xy, -x-y ) on a point chart"?
muneebalikiyani 19-May-13 23:47pm

yes u are right, i guess i have used wrong terminology..

Rate this:

## Solution 1

The important setting is the "Crossing" property on both the X-axis and Y-axis. It needs to be set to zero. Here is a simple example:

```Imports System.Windows.Forms.DataVisualization

Public Class Form1

Private WithEvents Chart1 As New Charting.Chart

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim series_1 As New Charting.Series
Dim chartarea_1 As New Charting.ChartArea

With Chart1
.Parent = Me
.Dock = DockStyle.Fill
.ChartAreas.Clear()
With chartarea_1
With .AxisX
.Crossing = 0 ' this is the important setting
.Minimum = -20
.Maximum = 20
.MajorGrid.Enabled = True
.LineWidth = 2
.Interval = 5
.MajorGrid.LineDashStyle = Charting.ChartDashStyle.Dot
End With

With .AxisY
.Crossing = 0 ' this is the important setting
.Minimum = -20
.Maximum = 20
.LineWidth = 2
.Interval = 5
.MajorGrid.LineDashStyle = Charting.ChartDashStyle.Dot
End With

End With

' make some data to chart
.Series.Clear()
With series_1

.ChartType = Charting.SeriesChartType.Spline
.IsVisibleInLegend = False
.ChartArea = chartarea_1.Name
Dim rnd As New Random

For x As Double = -20 To 20
.Points.AddXY(x, (rnd.NextDouble() * 40.0#) - 20.0#)
Next
End With
End With

End Sub

Private Sub Chart1_FormatNumber(ByVal sender As Object, ByVal e As System.Windows.Forms.DataVisualization.Charting.FormatNumberEventArgs) Handles Chart1.FormatNumber
If e.ElementType = Charting.ChartElementType.AxisLabels AndAlso e.Value = 0 Then
' do not print out zero on the axis
e.LocalizedValue = ""
End If
End Sub

End Class```
muneebalikiyani 20-May-13 1:44am

Thanks alot it works :)

Top Experts
Last 24hrsThis month
 OriginalGriff 380 Richard Deeming 244 Richard MacCutchan 200 Karthik Bangalore 190 ppolymorphe 100
 OriginalGriff 6,508 Karthik Bangalore 2,572 ppolymorphe 2,540 F-ES Sitecore 1,977 Richard MacCutchan 1,952