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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

the data point doesn''t line up with the bar

Thread ID:

Created:

Updated:

Platform:

Replies:

59033 Apr 3,2007 09:33 PM UTC Apr 25,2007 11:22 AM UTC WinForms 8
loading
Tags: Chart
Hongbin Zhang
Asked On April 3, 2007 09:33 PM UTC

Hi,
I just upgraded Syncfusion from v3.2 to v4.2. The graph components built under v3.2 has problems such as the data point doesn't line up with the bar, there is a offset for the yAxis. Here is a code sneppit, can you let me know how I can fix it, or this is a bug for v4.2?

Thanks,
HB

for(int i = 0; i < barSeries.Points.Count; i++)
{
ChartCustomPoint cp = new ChartCustomPoint();
cp.PointIndex = i;
cp.SeriesIndex = 0;
cp.CustomType = ChartCustomPointType.PointFollow;
cp.Text = Convert.ToString(dt.Rows[i][2]);
cp.Symbol.Shape = ChartSymbolShape.Square;
cp.Symbol.Color = Color.DarkCyan;
cp.Symbol.Size = new Size(5,5);
cp.Font.Bold = true;
cp.Offset = 5;
cp.Alignment = ChartTextOrientation.Right;
cp.Symbol.Marker.LineInfo.Width = 4;
this.myChart.CustomPoints.Add(cp);
}

// Update legend and axis with bar graph specific settings
this.myChart.Legend.Visible = false;
this.myChart.PrimaryXAxis.RangeType = ChartAxisRangeType.Auto;
this.myChart.PrimaryXAxis.Range.Min = 0;
this.myChart.PrimaryXAxis.Range.Max = 100;

this.myChart.PrimaryYAxis.CustomOrigin = true;
this.myChart.PrimaryYAxis.Origin = 5;

// Set the labesl on Y Axis
this.myChart.PrimaryYAxis.LabelsImpl = new LabelModel(dt,0);
this.myChart.PrimaryYAxis.ValueType = ChartValueType.Custom;

myChart.PrimaryXAxis.Title = xaxisTitle;
myChart.PrimaryYAxis.Title = yaxisTitle;

// display grid lines for x and y axis
myChart.PrimaryXAxis.DrawGrid = true;
myChart.PrimaryYAxis.DrawGrid = false;

myChart.PrimaryXAxis.TickColor = System.Drawing.Color.Brown;
myChart.PrimaryYAxis.TickColor = System.Drawing.Color.Brown;

myChart.PrimaryXAxis.TickSize = new Size(3,3);
myChart.PrimaryYAxis.TickSize = new Size(3,3);

myChart.PrimaryXAxis.LabelAligment = StringAlignment.Center;
myChart.PrimaryXAxis.LabelIntersectAction = ChartLabelIntersectAction.MultipleRows;

myChart.PrimaryYAxis.LabelAligment = StringAlignment.Center;
myChart.PrimaryYAxis.LabelIntersectAction = ChartLabelIntersectAction.MultipleRows;

myChart.PrimaryXAxis.Font = new Font("Arial",10,FontStyle.Bold);
myChart.PrimaryYAxis.Font = new Font("Arial",10,FontStyle.Bold);

myChart.PrimaryXAxis.GridLineType.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
myChart.PrimaryXAxis.GridLineType.Width = 1;
myChart.PrimaryYAxis.GridLineType.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
myChart.PrimaryYAxis.GridLineType.Width = 1;

myChart.PrimaryXAxis.LineType.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
myChart.PrimaryXAxis.LineType.Width = 2;
myChart.PrimaryYAxis.LineType.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
myChart.PrimaryYAxis.LineType.Width = 2;



barChartIssue.zip

Rajesh C [Syncfusion]
Replied On April 4, 2007 02:04 AM UTC

Hi,

Thank you for using Syncfusion products.

The ChartAxis padding range is default behavior of v4.2. Please try to set RangePaddingType as None and refer to the following code snippet.

[ C# ]

this.chartControl1.PrimaryXAxis.RangePaddingType = ChartAxisRangePaddingType.None;

Please let me know if you have any queries.

Regards,
Rajesh

Hongbin Zhang
Replied On April 4, 2007 01:44 PM UTC

Hi Rajesh,

thanks for the quick response. I added the line of code you suggested, I still have the issue I had before, if you look at the graph closely, you will see that the YAxis of each bar is offset from the data point. i.e. The upper line of bar NY440 should meet the 1/1=100% data point, instead, it was shifted below, so are other bars. Do you know what's the cause?

Thanks,
HB

barChartIssue0.zip

Ramya R [Syncfusion]
Replied On April 12, 2007 01:13 PM UTC

Hi,

This is a bug with our v4.2 and this issue has been fixed in our latest version 4.4.0.51. So could you please upgrade to our latest version.

In this v4.4, kindly implement the IChartSeriesIndexedModel and use it to create the series if your intention is to implement IChartAxisLabelModel and create custom labels.

I have also attached a sample created using v4.4.0.51 as per your requirement with this post.

You can download the sample from the below given Webpage link,
http://websamples.syncfusion.com/samples/Chart.Windows/F59033/main.htm

Let me know if you have any queries.

Thanks & Regards,
Ramya.

Chong Wong
Replied On April 23, 2007 05:30 PM UTC

Hi Ramya,

I work with HB, the original poster of this thread.

We have upgraded to 4.4.0.51 and the Y-Axis data point offset problem has been fixed, thanks.

Thanks for providing the sample, but there are still issues with the custom labels, even with your provided sample. Eg: in your sample you provide 5 data points + 5 labels - This works perfect. But try 3 data points + 3 labels, and the labels on the Y axis are not lined up with the graph bars, and the graph bars are different sizes. Even 2 data points + 2 labels gives y-axis labelling problems.

Strange how it works depending on the number of data points you pass in.

I have attached your example with my 3 data points + labels so you can recreate the error.

Please can you help?

Thanks,
Chong

BarChartSampleProblem.zip

Administrator [Syncfusion]
Replied On April 24, 2007 09:15 AM UTC

Hi Chong,

Thank You for the update.

I was able to visualize the condition that you have mentioned here.

You can overcome this condition by setting the DesiredIntervals property with a value equal to the number of points added to series. Kindly take a look at the code snippet below,

this.chartControl1.PrimaryYAxis.DesiredIntervals= this.chartControl1.Series[0].Points.Count;

The size of the bar vary according to the number of values along the axis so that all the points added to the series get displayed. The size of bar gets automatically adjusted when the number of values along the Y-Axis is increased or decreased.

Let me know whether this helps you.

Thanks & Regards,
Ramya.

Chong Wong
Replied On April 24, 2007 03:22 PM UTC

Hi Ramya,

Thanks for the quick reply.

I tried your code snippet and it works partially. If I have 10 or less data points, it's perfect! If i have more than 10 data points, same problem as before: the custom labels are either missing and/or not aligned...

We have over 10 data points to plot in our application...!

Please could you help further?

Many Thanks,
Chong

Ramya R [Syncfusion]
Replied On April 25, 2007 11:00 AM UTC

Hi Chong,

Thank You for the update.

I was able to visualize the condition that you have mentioned here.

You can overcome this condition using the code snippet below,

this.chartControl1.PrimaryYAxis.RangeType=ChartAxisRangeType.Set;
this.chartControl1.PrimaryYAxis.Range=new MinMaxInfo(-1,this.chartControl1.Series[0].Points.Count,1);

Kindly add the above code snippet after the adding the series to the ChartControl SeriesCollection and also comment the DesiredIntervals snippet which I gave you in the previous update.

Let me whether this helps you.

Thanks & Regards,
Ramya.

Chong Wong
Replied On April 25, 2007 11:22 AM UTC

Hi Ramya,

That works perfect now! Thank you so much for your help!

Another happy Syncfusion customer :)

Regards,
Chong

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;