hi all. I have data for a textual date against some double values. Say the data is:
09-2009 -> 1000000
10-2009 -> 2000000
When i render the data i dont see anything. the y-axis starts from 0 and increases in steps of 0.10 so the max is see is something like 1
How can i fix this?
The chart was designed to have that extra space in the axis range only to make the numbers round, so if your max value were 6.8 mil, the range would go up to 7 mil. But, since the axis label values are round enough to begin with the range ends with 7 mil. What you are trying to do requires a little extra code, but it can be done with a custom axis range.
ultraChart1.Axis.Y.TickmarkStyle = AxisTickStyle.DataInterval;ultraChart1.Axis.Y.TickmarkInterval = 1000000;ultraChart1.Axis.Y.RangeMin = 0;ultraChart1.Axis.Y.RangeMax = 7200000;ultraChart1.Axis.Y.RangeType = AxisRangeType.Custom;
The trick is to know what the min and max values really are based on your data, so you'll have to create a method that extracts the minimum and maximum from your data table, or whatever datasource you're using and set RangeMin and RangeMax accordingly.
i found that problem but now if my max value is say 7mil then the y-axis shows up to that number while it should also show values slightly higher so that no lines are cut off in the margins. any ideas how this is possible? thx
Not sure why you're not seeing a chart, but it's hard to guess without seeing how you're trying to implement it. However, here's a code snippet that will hopefully get you started:
DataTable dt = new DataTable();dt.Columns.Add("date", typeof(string));dt.Columns.Add("value", typeof(double));dt.Rows.Add("09-2009", 1000000);dt.Rows.Add("10-2009", 2000000);
ultraChart1.ChartType = ChartType.ColumnChart;ultraChart1.Data.ZeroAligned = true;ultraChart1.DataSource = dt;