This is a migrated thread and some comments may be shown as answers.

Manual ScaleBreak on Y-axis

3 Answers 82 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Felipe Saldana
Top achievements
Rank 1
Felipe Saldana asked on 12 Feb 2010, 07:27 PM
I am having some trouble getting a scale break to display on my chart.

I only want to have 10 labels on the Y axis so in the BeforeLayout event I do the following

            double max = Math.Floor(chart.PlotArea.YAxis.MaxValue); 
            double step = Math.Round( max / 10); 
 
            chart.PlotArea.YAxis.Clear(); 
            chart.PlotArea.YAxis.AutoScale = false
            chart.PlotArea.YAxis.AddRange(0, max, step); 
 
            AxisSegment seg = new AxisSegment(); 
            seg.Name = "asdfasdfasdf"
            seg.MaxValue = 3000; 
            seg.MinValue = 100; 
            seg.Step = 1000; 
 
            chart.PlotArea.YAxis.ScaleBreaks.Segments.Add(seg); 
            chart.PlotArea.YAxis.ScaleBreaks.MaxCount = 1; 
            chart.PlotArea.YAxis.ScaleBreaks.Enabled = true
 

The range is displays correctly. But when I turn ScaleBreaks.Enabled = true nothing displays on the Y axis. The range does not appear and neither does the ScaleBreak.

Seems like it should be fairly straight forward... anyone have any ideas on why this does not work.

Thanks!


3 Answers, 1 is accepted

Sort by
0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 17 Feb 2010, 11:53 AM
Hello Felipe,

I think you need to specify at least two segments when specifying scale breaks manually in order to achieve the desired effect:

ChartSeries series = new ChartSeries(); 
series.AddItem(700); 
series.AddItem(1200); 
series.AddItem(2100); 
series.AddItem(700); 
series.AddItem(3100); 
 
RadChart1.Series.Add(series); 
 
RadChart1.PlotArea.YAxis.Clear(); 
RadChart1.PlotArea.YAxis.AutoScale = false
RadChart1.PlotArea.YAxis.AddRange(0, 5000, 1000); 
 
AxisSegment seg2 = new AxisSegment(); 
seg2.MaxValue = 1500; 
seg2.MinValue = 0; 
seg2.Step = 500; 
RadChart1.PlotArea.YAxis.ScaleBreaks.Segments.Add(seg2); 
 
AxisSegment seg = new AxisSegment(); 
seg.MaxValue = 5000; 
seg.MinValue = 2000; 
seg.Step = 1000; 
RadChart1.PlotArea.YAxis.ScaleBreaks.Segments.Add(seg); 
 
RadChart1.PlotArea.YAxis.ScaleBreaks.Enabled = true


Greetings,
Bart.
0
Felipe Saldana
Top achievements
Rank 1
answered on 17 Feb 2010, 05:09 PM
I added another segment and I still get the same results that I stated.

Where are are setting up the chart at? Page_Load?

I am setting the chart in chart_BeforeLayout.....Is it possible that I cannot add any segments in this event?
0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 19 Feb 2010, 09:29 AM
Hello Felipe,

Indeed I'm setting the segments on Page_Load -- it seems setting them on BeforeLayout is not supported by RadChart.


Greetings,
Bart.
Tags
Chart (Obsolete)
Asked by
Felipe Saldana
Top achievements
Rank 1
Answers by
Bartholomeo Rocca
Top achievements
Rank 1
Felipe Saldana
Top achievements
Rank 1
Share this question
or