Muhammad Shoaib
Top achievements
Rank 1
Muhammad Shoaib
asked on 24 Jun 2009, 12:44 PM
Hi Every one,
I want to build a class inherits from charts to make my charting dynamic. But when i try to make such class and add properties of chart control , it fails to set the properties and shows it read only.
Regards
Muhammad Shoaib.
I want to build a class inherits from charts to make my charting dynamic. But when i try to make such class and add properties of chart control , it fails to set the properties and shows it read only.
Regards
Muhammad Shoaib.
7 Answers, 1 is accepted
0
Hi Muhammad,
Can you please provide more details about your scenario? I have created a small page to test it and it seems to work fine. You can find it attached.
Sincerely,
Ves
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.
Can you please provide more details about your scenario? I have created a small page to test it and it seems to work fine. You can find it attached.
Sincerely,
Ves
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.
0
Muhammad Shoaib
Top achievements
Rank 1
answered on 30 Jun 2009, 06:31 AM
Hi Ves,
Thanx for providing me the solution. It is very much useful for me, Now i have one more query about stacked bar chart. Actually i am new to telerik charts. I have 3 series named Space limit used, space limit projected, space limit total and i am providing it to my chart like this.
ChartSeries cs = new ChartSeries();
ChartSeries cs1 = new ChartSeries();
ChartSeries cs2 = new ChartSeries();
cs.AddItem(GetSpaceLimitUsed(), "Space Limit Used");
cs.Name = "Used";
cs1.AddItem(4000, "Space Limit Projected");
cs1.Name = "Projected";
cs2.AddItem(6000, "Space Limit Total");
cs2.Name = "Total";
objMyBarChart.Series.Add(cs);
objMyBarChart.Series.Add(cs1);
objMyBarChart.Series.Add(cs2);
It will draw the chart image as three bars seperately ,but i want it to be drawn three bars one on another showing one stacked bar.
Regards
Muhammad Shoaib
Thanx for providing me the solution. It is very much useful for me, Now i have one more query about stacked bar chart. Actually i am new to telerik charts. I have 3 series named Space limit used, space limit projected, space limit total and i am providing it to my chart like this.
ChartSeries cs = new ChartSeries();
ChartSeries cs1 = new ChartSeries();
ChartSeries cs2 = new ChartSeries();
cs.AddItem(GetSpaceLimitUsed(), "Space Limit Used");
cs.Name = "Used";
cs1.AddItem(4000, "Space Limit Projected");
cs1.Name = "Projected";
cs2.AddItem(6000, "Space Limit Total");
cs2.Name = "Total";
objMyBarChart.Series.Add(cs);
objMyBarChart.Series.Add(cs1);
objMyBarChart.Series.Add(cs2);
It will draw the chart image as three bars seperately ,but i want it to be drawn three bars one on another showing one stacked bar.
Regards
Muhammad Shoaib
0
Hello Muhammad,
Now all you need is to set the series type:
cs.Type = ChartSeriesType.StackedBar;
cs1.Type = ChartSeriesType.StackedBar;
cs2.Type = ChartSeriesType.StackedBar;
Best regards,
Ves
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.
Now all you need is to set the series type:
cs.Type = ChartSeriesType.StackedBar;
cs1.Type = ChartSeriesType.StackedBar;
cs2.Type = ChartSeriesType.StackedBar;
Best regards,
Ves
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.
0
Muhammad Shoaib
Top achievements
Rank 1
answered on 06 Jul 2009, 12:01 PM
hi,
i have another query .I am making dynamic chats controls, i am getting problems in settings colors of chart in plot area and text color of legend. I am passing colors in series items , the colors drawn in the chart is of gradient not solid. Secondly the legend items text color is not changed w r t skin. eg i am using black skin , all items of the chart has been changed to white except the legend color. note that i am making legend dynamically w . r. t series items.
Here is my code.
//passing series to chart , with series items and colors
ChartSeries csud = new ChartSeries();
csud.Type = ChartSeriesType.Pie;
csud.AddItem(7000, "Total",Color.Red);
csud.AddItem(3500, "Projected",Color.Blue);
csud.AddItem(2000, "Used",Color.Green);
csud.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
//making dynamic legend according to chart series items.
if (RadChart1.Series.Count == 1)
{
int j = 0;
for (j = 0; j < RadChart1.Series[0].Items.Count; j++)
{
LabelItem lblitem = new LabelItem();
lblitem.TextBlock.Text = RadChart1.Series[0].Items[j].Label.TextBlock.Text;
RadChart1.Legend.Items.Add(lblitem);
RadChart1.Legend.Items[j].Marker.Appearance.FillStyle.MainColor = RadChart1.Series[0].Items[j].Appearance.FillStyle.MainColor;
}
}
Regards.
Muhammad Shoaib
i have another query .I am making dynamic chats controls, i am getting problems in settings colors of chart in plot area and text color of legend. I am passing colors in series items , the colors drawn in the chart is of gradient not solid. Secondly the legend items text color is not changed w r t skin. eg i am using black skin , all items of the chart has been changed to white except the legend color. note that i am making legend dynamically w . r. t series items.
Here is my code.
//passing series to chart , with series items and colors
ChartSeries csud = new ChartSeries();
csud.Type = ChartSeriesType.Pie;
csud.AddItem(7000, "Total",Color.Red);
csud.AddItem(3500, "Projected",Color.Blue);
csud.AddItem(2000, "Used",Color.Green);
csud.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
//making dynamic legend according to chart series items.
if (RadChart1.Series.Count == 1)
{
int j = 0;
for (j = 0; j < RadChart1.Series[0].Items.Count; j++)
{
LabelItem lblitem = new LabelItem();
lblitem.TextBlock.Text = RadChart1.Series[0].Items[j].Label.TextBlock.Text;
RadChart1.Legend.Items.Add(lblitem);
RadChart1.Legend.Items[j].Marker.Appearance.FillStyle.MainColor = RadChart1.Series[0].Items[j].Appearance.FillStyle.MainColor;
}
}
Regards.
Muhammad Shoaib
0
Hi Muhammad,
You can find attached a small example. Hope this will help.
All the best,
Ves
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.
You can find attached a small example. Hope this will help.
All the best,
Ves
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.
0
kiran
Top achievements
Rank 1
answered on 09 Dec 2011, 12:25 PM
i Have seen the solution .it is quite good.But i have a requirement like the
Space Limit Used
Space Limit Projected
Space Limit Total
on the x-axis
but now i am getting a integer 1 i am attaching the image for your reference ......
and Can i have some specify some space between the bars and i want to name x-axis (for ex -year ) and y-axis (sales)
which mean for 12-01-2009(x-axis) 50% (Y-axis) sale
and so on and so forth.
This is the same code
ChartSeries cs = new ChartSeries();
ChartSeries cs1 = new ChartSeries();
ChartSeries cs2 = new ChartSeries();
cs.Type = ChartSeriesType.Bar;
cs1.Type = ChartSeriesType.Bar;
cs2.Type = ChartSeriesType.Bar;
cs.AddItem(2000, "Space Limit Used");
cs.Name = "Used";
cs1.AddItem(4000, "Space Limit Projected");
cs1.Name = "Projected";
cs2.AddItem(6000, "Space Limit Total");
cs2.Name = "Total";
objMyBarChart.Series.Add(cs);
objMyBarChart.Series.Add(cs1);
objMyBarChart.Series.Add(cs2);
Space Limit Used
Space Limit Projected
Space Limit Total
on the x-axis
but now i am getting a integer 1 i am attaching the image for your reference ......
and Can i have some specify some space between the bars and i want to name x-axis (for ex -year ) and y-axis (sales)
which mean for 12-01-2009(x-axis) 50% (Y-axis) sale
and so on and so forth.
This is the same code
ChartSeries cs = new ChartSeries();
ChartSeries cs1 = new ChartSeries();
ChartSeries cs2 = new ChartSeries();
cs.Type = ChartSeriesType.Bar;
cs1.Type = ChartSeriesType.Bar;
cs2.Type = ChartSeriesType.Bar;
cs.AddItem(2000, "Space Limit Used");
cs.Name = "Used";
cs1.AddItem(4000, "Space Limit Projected");
cs1.Name = "Projected";
cs2.AddItem(6000, "Space Limit Total");
cs2.Name = "Total";
objMyBarChart.Series.Add(cs);
objMyBarChart.Series.Add(cs1);
objMyBarChart.Series.Add(cs2);
0
Hi Kiran,
I am a bit confused here. First, there is a requirement about "Space Limit Used, Space Limit Projected, Space Limit Total, on the x-axis" but later you mention dates for X axis.Can you please send us an image or a scratch, which shows how you would like the chart to look like with the data you have specified, so we can get back to you with a suggestion? Thanks.
Best regards,
Ves
the Telerik team
I am a bit confused here. First, there is a requirement about "Space Limit Used, Space Limit Projected, Space Limit Total, on the x-axis" but later you mention dates for X axis.Can you please send us an image or a scratch, which shows how you would like the chart to look like with the data you have specified, so we can get back to you with a suggestion? Thanks.
Best regards,
Ves
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now