Senthil Posted September 11, 2007 Report Share Posted September 11, 2007 Step values are not properly applied for x Axis in my horizontal Bar. Please find the following code lines chtChart.AxisX.Max = dblFrMax; chtChart.AxisX.Min = dblFrMin; chtChart.AxisX.Step = (dblFrMax - dblFrMin) / (intMax - intMin); My values are as follows Data Values for x aixs are 65.0, 66.7, 68.4, 70.1, 71.8, 73.5 and 75.2 dblFrMax=75.2 dblFrMin=65.0 (dblFrMax - dblFrMin) / (intMax - intMin) = 1.70000004 (After Calculations) i want the Labels in my X axis to be 65.0, 66.7, 68.4.. but it is displaying 66.3 and 68.0.. What i have to do get it displayed like 65.0, 66.7.. I am using Chart Fx 2005. Please help me in this regards Regards, Senthil. Link to comment Share on other sites More sharing options...
AndreG Posted September 13, 2007 Report Share Posted September 13, 2007 Dear Senthil, Bar charts are meant to work with categorical X axis only. By passing X values to your chart, you are making the X axis numerical. I believe you would get the desired results if you pass your X values as labels, not data. The following code will generate the chart I think you are looking for, with random data on the Y axis and your data as X axis labels. chart1.Data.Series = 1; chart1.Data.Points = 7;Random r = new Random();for (int i = 0; i < chart1.Data.Series; i++) {for (int j = 0; j < chart1.Data.Points; j++) { chart1.Data[i, j] = r.Next(100); } }chart1.AxisX.Labels[0] = "65.0"; chart1.AxisX.Labels[1] = "66.7";chart1.AxisX.Labels[2] = "68.4"; chart1.AxisX.Labels[3] = "70.1";chart1.AxisX.Labels[4] = "71.8"; chart1.AxisX.Labels[5] = "73.5";chart1.AxisX.Labels[6] = "75.2"; chart1.Gallery = Gallery.Bar;chart1.AllSeries.Horizontal = true; Regards, AndreG Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.