Manual ScaleBreak on Y-axis

Thread is closed for posting
4 posts, 0 answers
  1. Felipe Saldana
    Felipe Saldana avatar
    62 posts
    Member since:
    Jan 2009

    Posted 12 Feb 2010 Link to this post

    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!


  2. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 17 Feb 2010 Link to this post

    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.
  3. Felipe Saldana
    Felipe Saldana avatar
    62 posts
    Member since:
    Jan 2009

    Posted 17 Feb 2010 Link to this post

    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?
  4. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 19 Feb 2010 Link to this post

    Hello Felipe,

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


    Greetings,
    Bart.
Back to Top