line chart data too close to axis

Hi,

I have a line chart with a thickness of 20 pixels. In the example I have attached, there are two lines. Because the orange line is close to the x-axis, you can only see half of the pixels. (Compare the thickness with the blue line).

Is there a way that I can move all of the data up a little bit so that I can see the entire orange line?

I suppose I could achieve acceptable behavior by adding one more unit (in this example, make the minimum -1 instead of 0), but then I would need to prevent the -1 from being displayed.

Can you advise how to do this, or provide any workarounds?

Thank you, BenT

ChartDataNearAxis.zip

5 Replies

AD Administrator Syncfusion Team March 15, 2007 08:58 PM UTC

Hi BenT,

Thank you for using Syncfusion products.

You can move the all data up by using Offset property of primary Y-axis. Please refer to the following code snippet.

[ C# ]

this.chartControl1.PrimaryYAxis.Offset =1;

Please let me know if you have any queries.

Regards,
Rajesh


BT Ben Tsai March 16, 2007 12:33 PM UTC

Hi Rajesh,

Thanks for your reply.

This isn't exactly what I was looking for. I tried out setting ChartControl.PrimaryYAxis.Offset to 1, and this does move the data up away from the y-axis. But, it also moves the above data off the chart.

I have attached another example that demonstrates this. If you toggle the checkbox that sets the offset, you will see that the blue bar disappears. What I want is a way to add some kind of padding to both ends of the data. Does that make sense?

Thank you,
BenT

Syncfusion 4.4.0.51
VS 2005

>Hi BenT,

Thank you for using Syncfusion products.

You can move the all data up by using Offset property of primary Y-axis. Please refer to the following code snippet.

[ C# ]

this.chartControl1.PrimaryYAxis.Offset =1;

Please let me know if you have any queries.

Regards,
Rajesh

ChartDataNearAxis0.zip


AD Administrator Syncfusion Team March 17, 2007 02:39 AM UTC

Hi BanT,

Thank you for the update.

I have modified your sample. In this sample will support the padding for both end of the data. Please have a look at this sample and let me know if this helps you.

http://www.syncfusion.com/Support/user/uploads/ChartDataNearAxis_198776d.zip

You can change the offset value of padding by using user define function PaddingBothEnd(offset).

Regards,
Rajesh


BT Ben Tsai March 19, 2007 04:36 PM UTC

Hi Rajesh,

This is much closer to what I am looking for. Can you show me how to do this if the PrimaryYAxis is of ValueType DateTime? I couldn't figure out how to specify the position of the label with the ChartAxisLabel constructor.

Thank you,
BenT

>Hi BanT,

Thank you for the update.

I have modified your sample. In this sample will support the padding for both end of the data. Please have a look at this sample and let me know if this helps you.

http://www.syncfusion.com/Support/user/uploads/ChartDataNearAxis_198776d.zip

You can change the offset value of padding by using user define function PaddingBothEnd(offset).

Regards,
Rajesh


AD Administrator Syncfusion Team March 19, 2007 09:34 PM UTC

Hi BenT,

Thank you for the update.

You can convert double to DateTime using DateTime.FromOADate() function and also set format for DateTime, Please refer to the following code snippet.

[ C# ]
this.chartControl1.PrimaryYAxis.Labels.Add(new ChartAxisLabel(DateTime.FromOADate(i).ToString("MM/dd/yyyy") , Color.Black , new Font("Times New Roman", 12), i, "", ChartValueType.Custom));

Also kindly take a look at the attached sample.

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

Please let me know if you have any queries.

Regards,
Rajesh

Loader.
Up arrow icon