Profile Picture

Stack chart appearance.

Posted By Hasindu Diyabalanage 13 Years Ago
Author
Message
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Hasindu,

You can force the axis zone to have some minimum width / height:

NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
chart.BoundsMode = BoundsMode.Stretch;
chart.MinDockZoneMargins = new NMarginsL(100, 0, 0, 0);
chart.MaxDockZoneMargins = new NMarginsL(10000, 10000, 10000, 10000);


The above code for example applies a mimimum width for the left axis zone of 100 points. In your case that will probably be the x axis as it looks like you're using left to right orientation.



Best Regards,
Nevron Support Team



Hasindu Diyabalanage
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 7, Visits: 1
Hi,

Many thanks for your reply.

Issue 2 about hiding y axis labels worked.

Issue 1, there seems to be a misunderstanding here. I was referring to the y axis labels not the legend. Therefore what I mean is, fixing the width of the y axis label and the graphic separately. Fixing the chart width affects the graphic and the y axis labels. Is this possible?

Thanks,
Hasindu

Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Hasindu,

1. You can modify the chart and label Positon and size independently. The following code shows how to do that:

   NChart chart = nChartControl1.Charts[0];

   chart.BoundsMode = BoundsMode.Stretch;
   chart.Location = new NPointL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage));
   chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));

   NBarSeries bar = new NBarSeries();
   bar.Values.Add(10);
   bar.Values.Add(20);
   bar.Values.Add(30);
   chart.Series.Add(bar);

   NLegend legend = nChartControl1.Legends[0];

   legend.BoundsMode = BoundsMode.None;
   legend.UseAutomaticSize = false;
   legend.ContentAlignment = ContentAlignment.BottomRight;
   legend.FitAlignment = ContentAlignment.TopCenter;
   legend.Location = new NPointL(new NLength(80, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage));
   legend.Size = new NSizeL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(80, NRelativeUnit.ParentPercentage));

for more advanced legend positioning options you can take a look at All Examples\Panels\Legend\Position and All Examples\Panels\Legend\Docking.

2. To hide the y axis labels you have to turn off autolabelling:

NLinearScaleConfigurator yScale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
yScale.AutoLabels = false;

Hope this helps - let us know if you meet any problems.



Best Regards,
Nevron Support Team



Hasindu Diyabalanage
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)Forum Newbie (7 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 7, Visits: 1
Hi Again,

Got two more question.

As shown on the image (StackChartOverlapping Legend), the chart overlaps with the legend. I have set a width for the chart and a position, but then as shown in Image 2. when the y axis labels are very short the graphic (chart) goes back and looks quite long. Is there any way to give the label portion and the graphic portion two different widths or positions? Or is there any other solution for this.

FYI - I have limited the legend and label text to 29 characters.

Second question refers to all charts, is there a way to hide the y axis labels from displaying?

Many thanks for your help.
Hasindu

Attachments
Image 2.png (50 views, 73.00 KB)
StackChartOverlapping Legend.png (49 views, 32.00 KB)


Similar Topics


Reading This Topic