Profile Picture

Polar and Cartesian Charts

Posted By Michael Hayford 14 Years Ago
Author
Message
Michael Hayford
questionmark Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1
I am trying to display both a NCartesianChart and NPolarChart in the same control. I can only get the first one that I add to the control to show up. Is this not permitted or do I have to do something special? I can post code if needed.
Thanks
Mike

bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Michael,

There is no restriction to the number of charts (or other types of panels) you can add to the control. The following code snippet shows how to create a chart layout containing a title and two charts - Cartesian and Polar. I've also played a bit to make it resizable:

// start with a clear chart
nChartControl1.Panels.Clear();

// create a title and dock it to the top of the chart
NLabel title = new NLabel();
title.Text =
"Some Title";
title.Dock =
DockStyle.Top;

NDockPanel dockPanel = new NDockPanel();
dockPanel.Dock =
DockStyle.Fill;

// create a cartesian chart occupying the left side of the dock panel
NCartesianChart cartesianChart = new NCartesianChart();
cartesianChart.Location =
new NPointL(0, 0);
cartesianChart.Size =
new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage),
new NLength(100, NRelativeUnit.ParentPercentage));

// offset the chart ten points from bounds
cartesianChart.Margins = new NMarginsL(10, 10, 10, 10);

// create a polar chart occupying the right side of the dock panel
NPolarChart polarChart = new NPolarChart();
polarChart.Location =
new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(0));
polarChart.Size =
new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage),
new NLength(100, NRelativeUnit.ParentPercentage));

// offset the chart ten points from bounds
polarChart.Margins = new NMarginsL(10, 10, 10, 10);

// add the panels to the chart
nChartControl1.Panels.Add(title);
nChartControl1.Panels.Add(dockPanel);
dockPanel.ChildPanels.Add(cartesianChart);
dockPanel.ChildPanels.Add(polarChart);

Hope this helps - let me know if you have any questions.

Best regards,
Bob



Michael Hayford
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1
Hi Bob,
Thank you for the quick response. I used your example (converted to VB) and see that I get 2 charts. I started adding my code back in to this framework. Many things work but I found one statement that causes problems. If I set

cartesianChart.Enabled3D = True

the polarChart disappears. If I replace the polarChart code with code for a second, 2D, cartesian chart, I see a 3D cartesian chart on the left and a 2D one on the right, as expected. I've pasted your example (in VB) with the additional statement below:

' start with a clear chart
NChartControl1.Panels.Clear()

' create a title and dock it to the top of the chart
Dim title As NLabel = New NLabel()
title.Text = "Some Title"
title.Dock = DockStyle.Top

Dim dockPanel As NDockPanel = New NDockPanel()
dockPanel.Dock = DockStyle.Fill

' create a cartesian chart occupying the left side of the dock panel
Dim cartesianChart As NCartesianChart = New NCartesianChart()
cartesianChart.Location = New NPointL(0, 0)
cartesianChart.Size = New NSizeL(New NLength(50, NRelativeUnit.ParentPercentage), New NLength(100, NRelativeUnit.ParentPercentage))

' offset the chart ten points from bounds
cartesianChart.Margins = New NMarginsL(10, 10, 10, 10)

cartesianChart.Enable3D = True ' **** CODE ADDED HERE ****

' create a polar chart occupying the right side of the dock panel
Dim polarChart As NPolarChart = New NPolarChart()
polarChart.Location = New NPointL(New NLength(50, NRelativeUnit.ParentPercentage), New NLength(0))
polarChart.Size = New NSizeL(New NLength(50, NRelativeUnit.ParentPercentage), New NLength(100, NRelativeUnit.ParentPercentage))

' offset the chart ten points from bounds
polarChart.Margins = New NMarginsL(10, 10, 10, 10)

' add the panels to the chart
NChartControl1.Panels.Add(title)
NChartControl1.Panels.Add(dockPanel)
dockPanel.ChildPanels.Add(cartesianChart)
dockPanel.ChildPanels.Add(polarChart)

Thanks in advance for your help.
Regards,
Mike


bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Michael,

Thanks for pointing this out - it turned out to be a small problem with the control when mixing 3D & polar / radar charts. It's fixed now and we'll upload a patch today.

Best regards,
Bob





Similar Topics


Reading This Topic