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

Multiple Series On Top Of Each Other

2 Answers 142 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jason Van Dusen
Top achievements
Rank 1
Jason Van Dusen asked on 06 May 2009, 09:57 PM
If I have two series, is it possible to show the second series on top of the first?  Any help would be greatly appreciated.  Basically what I am trying to do is show an overlap in time as a red bar and the rest of the bar as a different color.

Jason

2 Answers, 1 is accepted

Sort by
0
Jason Van Dusen
Top achievements
Rank 1
answered on 07 May 2009, 07:39 PM
I figured it out.

myChart.Appearance.BarOverlapPercent = 100
0
Dwight
Telerik team
answered on 08 May 2009, 08:37 AM
Hello Jason,

The default behavior of the RadChart to horizontally split the available space can be worked around by giving different X values for each of the series. Here is a short example:
public partial class Form1 : Form 
    public Form1() 
    { 
        Random random = new Random(0x65412); 
 
        InitializeComponent(); 
 
        ChartSeries series = new ChartSeries(); 
        ChartSeries coverSeries = new ChartSeries(); 
        series.Type = ChartSeriesType.Gantt; 
        coverSeries.Type = ChartSeriesType.Gantt; 
        coverSeries.Appearance.LabelAppearance.Visible = false
 
        for (int i = 0; i < 10; i++) 
        { 
            ChartSeriesItem item = new ChartSeriesItem(); 
            item.YValue2 = random.Next(50, 100); 
            item.YValue = random.Next(150, 200); 
            item.XValue = i; 
            series.Items.Add(item); 
 
            ChartSeriesItem coverItem = new ChartSeriesItem(); 
            coverItem.YValue2 = random.Next(105, 120); 
            coverItem.YValue = random.Next(130, 145); 
            coverItem.XValue = i + 0.0001; 
            coverSeries.Items.Add(coverItem); 
        } 
 
        this.radChart1.Series.Add(series); 
        this.radChart1.Series.Add(coverSeries); 
    } 

As you can see, the index of the respective item is used as it's X value, but for the second series, a constant of 0.0001 is added. That will make the chart to draw the second series on top of the first one.

Best,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Chart (obsolete as of Q1 2013)
Asked by
Jason Van Dusen
Top achievements
Rank 1
Answers by
Jason Van Dusen
Top achievements
Rank 1
Dwight
Telerik team
Share this question
or