We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to change Y Axis''s value to the 1 more arrange?

Dear All,
May I know is there any possibility to set my Y axis value to 0, 20, 40, 60, 80, 100 and so on for graph 1 below and – 100, -80, -60, - 40, -20, 0, 20, 40, 60 and so on for graph 2 below?

p/s: please refer my attachment. thanks

hwee hoon

Question.zip

8 Replies

MW Melba Winshia Syncfusion Team September 20, 2007 06:07 AM UTC

Hi,

Thank you for your interest in Syncfusion Products.

Issue 1: (to set my Y axis value to 0, 20, 40, 60, 80, 100)
-----

You can set Y-axis value to 0, 20, 40, 60, 80, 100 by using the below code snippet.

//Set the Axes Range.
this.ChartWebControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this.ChartWebControl1.PrimaryYAxis.Range = new MinMaxInfo(0, 100, 20);

Issue 2: (– 100, -80, -60, - 40, -20, 0, 20, 40, 60 )
------

You can set Y-axis value to – 100, -80, -60, - 40, -20, 0, 20, 40, 60 by using the below code snippet.

//Set the Axes Range.
this.ChartWebControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this.ChartWebControl1.PrimaryYAxis.Range = new MinMaxInfo(-100, 60, 20);

Issue 3: (Currently I draw the legend myself by using picture box. Any others idea I can make it better)
--------

If your intention is to create a chart with legends, it can be achieved by using the FilterItems event. You can use ChartLegendItemType enum to select the type of legend (Rectangle, Image, Circle etc..) you need to display in the chart.

private void Legend_FilterItems(object sender, ChartLegendFilterItemsEventArgs e)
{

e.Items.Clear();
Syncfusion.Windows.Forms.Chart.ChartLegendItem s0 = new ChartLegendItem();
e.Items.Insert(0, s0);
e.Items[0].Type = ChartLegendItemType.Rectangle;
e.Items[0].Text = "-Best-In-Class";
e.Items[0].Interior = new Syncfusion.Drawing.BrushInfo(Color.Green);

Syncfusion.Windows.Forms.Chart.ChartLegendItem s1 = new ChartLegendItem();
e.Items.Insert(1, s1);
e.Items[1].Type = ChartLegendItemType.Circle;
e.Items[1].Text = "-Your Organization";
e.Items[1].Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow);

Syncfusion.Windows.Forms.Chart.ChartLegendItem s2 = new ChartLegendItem();
e.Items.Insert(2, s2);
e.Items[2].Type = ChartLegendItemType.Rectangle;
e.Items[2].Text = "-Average";
e.Items[2].Interior = new Syncfusion.Drawing.BrushInfo(Color.Lavender);

}


Please try this and let me know if this helps.

Thanks,
Melba


HW hweehoon September 25, 2007 08:44 AM UTC

Hi,
thanks for ur guide for the personalize legend. but for the primary axis problem after i apply with your setting i still have the decimal point for my Y axis.

any idea? thanks..

regards
hwee hoon

>Hi,

Thank you for your interest in Syncfusion Products.

Issue 1: (to set my Y axis value to 0, 20, 40, 60, 80, 100)
-----

You can set Y-axis value to 0, 20, 40, 60, 80, 100 by using the below code snippet.

//Set the Axes Range.
this.ChartWebControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this.ChartWebControl1.PrimaryYAxis.Range = new MinMaxInfo(0, 100, 20);

Issue 2: (– 100, -80, -60, - 40, -20, 0, 20, 40, 60 )
------

You can set Y-axis value to – 100, -80, -60, - 40, -20, 0, 20, 40, 60 by using the below code snippet.

//Set the Axes Range.
this.ChartWebControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this.ChartWebControl1.PrimaryYAxis.Range = new MinMaxInfo(-100, 60, 20);

Issue 3: (Currently I draw the legend myself by using picture box. Any others idea I can make it better)
--------

If your intention is to create a chart with legends, it can be achieved by using the FilterItems event. You can use ChartLegendItemType enum to select the type of legend (Rectangle, Image, Circle etc..) you need to display in the chart.

private void Legend_FilterItems(object sender, ChartLegendFilterItemsEventArgs e)
{

e.Items.Clear();
Syncfusion.Windows.Forms.Chart.ChartLegendItem s0 = new ChartLegendItem();
e.Items.Insert(0, s0);
e.Items[0].Type = ChartLegendItemType.Rectangle;
e.Items[0].Text = "-Best-In-Class";
e.Items[0].Interior = new Syncfusion.Drawing.BrushInfo(Color.Green);

Syncfusion.Windows.Forms.Chart.ChartLegendItem s1 = new ChartLegendItem();
e.Items.Insert(1, s1);
e.Items[1].Type = ChartLegendItemType.Circle;
e.Items[1].Text = "-Your Organization";
e.Items[1].Interior = new Syncfusion.Drawing.BrushInfo(Color.Yellow);

Syncfusion.Windows.Forms.Chart.ChartLegendItem s2 = new ChartLegendItem();
e.Items.Insert(2, s2);
e.Items[2].Type = ChartLegendItemType.Rectangle;
e.Items[2].Text = "-Average";
e.Items[2].Interior = new Syncfusion.Drawing.BrushInfo(Color.Lavender);

}


Please try this and let me know if this helps.

Thanks,
Melba

Question.zip


MW Melba Winshia Syncfusion Team September 26, 2007 06:44 AM UTC

Hi,

Thank you for the screenshot.

I am afraid that I was not able to reproduce the issue. Please refer to the following steps that I tried to reproduce it.

1. Created a sample by setting negative range for y axis
2. But not able to see decimal point in my Y axis

Also I have created a simple sample to test this issue and it is available in the following link.

http://websamples.syncfusion.com/samples/Chart.Web/5.2.0.25/68294_1/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?

Thanks,
Melba


HW hweehoon September 27, 2007 08:23 AM UTC

Thanks, i will try on your example when i free. any way thanks first. i just wonder y i will have decimal point. =)


HW hweehoon September 28, 2007 03:39 AM UTC

Hi,
Herewith attachment on my sample which i get decimal point to my YAxis. Just press the Open button you can get my graph (which attach together a xml file under bin)

thanks...

hwee hoon

TestOnGraphYAxis.zip


AD Administrator Syncfusion Team October 1, 2007 02:46 PM UTC

Hi Hwee,

Thanks for providing the sample.

If your intention is to display the integer values on Y axis, then please round off Y Axis values to zero decimal point.

Please refer the attached sample and let me know if this meets your requirement.

http://websamples.syncfusion.com/samples/Chart.Windows/F68320_Oct1/main.htm

Regards,
Jaya


HW hweehoon October 2, 2007 02:15 AM UTC

Hi,
If i need to show decimal point to my graph value instead of show it to round up value. is it my YAxis will remain the decimal point?

thanks..

regards
hwee hoon


AD Administrator Syncfusion Team October 2, 2007 05:51 PM UTC

Hi Hwee,

Thanks for the update.

Yes. The data points will be displayed in decimal point if the Y Axis values are in decimal point since data point received input from plotted series.

If your intention is to show decimal point at graph and non decimal point at Y Axis, then clear the existing labels and create desired labels at Y Axis.

Please let me know if you have any other queries.

Regards,
Jaya

Loader.
Live Chat Icon For mobile
Up arrow icon