8 Answers, 1 is accepted
0
Hi Joe,
I'm afraid that the provided information is insufficient for us to determine what might be the problem and we would need more info on how you create your chart, how you bind it etc. A sample runnable report would be appreciated and usually the fastest way to resolve an issue.
Kind regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I'm afraid that the provided information is insufficient for us to determine what might be the problem and we would need more info on how you create your chart, how you bind it etc. A sample runnable report would be appreciated and usually the fastest way to resolve an issue.
Kind regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe
Top achievements
Rank 2
answered on 11 Nov 2009, 07:16 PM
Sorry Steve,
I was forced to go with an alternate solution due to time constraints. I don't know for a fact that I could reduce it to a simple example. The same chart displayed in a different report in a slightly different manner worked as expected. It does seem to be a problem in some cases, though.
Thanks,
Joe
0
Jason
Top achievements
Rank 2
answered on 18 Jan 2010, 08:54 PM
I'm having the same problem.
0
John Hughes
Top achievements
Rank 1
answered on 11 Feb 2011, 08:20 PM
I am having the same issue. I see the labels in the HTML ReportViewer, but when I export to PDF the labels are not there.
Code snippets below from my need_datasource method. Please let me know if you see a glaring error in what I am doing.
I have also attached 2 screen shots of what I am seeing.
Thanks,
John
chart1.DataSource = msList;
decimal maxHits = (long)currentSession["maxHits"];
using (ChartSeries serie = new ChartSeries())
{
serie.Type = ChartSeriesType.Bar;
serie.Clear();
decimal numSteps = Math.Round((maxHits / 10) + 1);
chart1.PlotArea.YAxis.MaxValue = (double)maxHits;
chart1.PlotArea.YAxis.Step = (double)numSteps;
serie.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
foreach (MediaServiceResolverActivity lst in msList)
{
using (ChartSeriesItem item = new ChartSeriesItem())
{
item.YValue = (double)lst.RequestCount;
item.Name = (string)lst.MediaServiceName;
chart1.PlotArea.XAxis.DataLabelsColumn = "MediaServiceName";
chart1.PlotArea.YAxis.AutoScale = false;
item.Appearance.Exploded = true;
item.Label.TextBlock.Text = (string)lst.MediaServiceName;
serie.Items.Add(item);
serie.DefaultLabelValue = "D";
}
chart1.Series.Add(serie);
}
}
Code snippets below from my need_datasource method. Please let me know if you see a glaring error in what I am doing.
I have also attached 2 screen shots of what I am seeing.
Thanks,
John
chart1.DataSource = msList;
decimal maxHits = (long)currentSession["maxHits"];
using (ChartSeries serie = new ChartSeries())
{
serie.Type = ChartSeriesType.Bar;
serie.Clear();
decimal numSteps = Math.Round((maxHits / 10) + 1);
chart1.PlotArea.YAxis.MaxValue = (double)maxHits;
chart1.PlotArea.YAxis.Step = (double)numSteps;
serie.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
foreach (MediaServiceResolverActivity lst in msList)
{
using (ChartSeriesItem item = new ChartSeriesItem())
{
item.YValue = (double)lst.RequestCount;
item.Name = (string)lst.MediaServiceName;
chart1.PlotArea.XAxis.DataLabelsColumn = "MediaServiceName";
chart1.PlotArea.YAxis.AutoScale = false;
item.Appearance.Exploded = true;
item.Label.TextBlock.Text = (string)lst.MediaServiceName;
serie.Items.Add(item);
serie.DefaultLabelValue = "D";
}
chart1.Series.Add(serie);
}
}
0
Hi John,
Where is that code executed? As you probably know, every time the report is previewed, paged or exported through the viewer it is processed and rendered from scratch. Check whether upon export your code is executed again and whether it goes in the foreach loops as expected.
If you are unable to pinpoint the issue, please open a support ticket and attach a runnable sample that exhibits the problem and we would advise you accordingly.
Greetings,
Steve
the Telerik team
Where is that code executed? As you probably know, every time the report is previewed, paged or exported through the viewer it is processed and rendered from scratch. Check whether upon export your code is executed again and whether it goes in the foreach loops as expected.
If you are unable to pinpoint the issue, please open a support ticket and attach a runnable sample that exhibits the problem and we would advise you accordingly.
Greetings,
Steve
the Telerik team
0
John Hughes
Top achievements
Rank 1
answered on 15 Feb 2011, 08:09 PM
Sorry about that. This is in my method for NeedDataSource. This code does NOT get executed when I export the chart report to PDF. Not only do the labels disappear, but all of the other programmatic settings do too. i.e. Size of chart, step size, etc.
Is there another method that gets called for exporting that I need similar code in? I went in and hand edited the designer created CS file and got it to work. i.e. I added this line to the designer file.
this.chart1.PlotArea.XAxis.DataLabelsColumn = "MediaServiceName";
Any suggestions would be appreciated.
Thanks,
John
Is there another method that gets called for exporting that I need similar code in? I went in and hand edited the designer created CS file and got it to work. i.e. I added this line to the designer file.
this.chart1.PlotArea.XAxis.DataLabelsColumn = "MediaServiceName";
Any suggestions would be appreciated.
Thanks,
John
0
John Hughes
Top achievements
Rank 1
answered on 15 Feb 2011, 10:46 PM
I switched from using the NeedDataSource event to ItemDataBinding and that seems to have fixed it. Does this seem like the right solution?
Thanks,
John
Thanks,
John
0
Hello John,
Yes, the ItemDataBinding event is a valid solution as it would be fired regardless whether the chart has data source set. Here is more info if you are interested:
The chart NeedDataSource event is fired only when the chart does not have data source set. So when in your code you set chart1.DataSource = msList; the chart accepts this as the data source and the event is not fired anymore. The reason is that chart1 is the definition report item i.e. the same as setting data source directly in the designer. When you're in the context of NeedDataSource, you should work with the processing report item instead - more information is available in the Understanding Events help article.
Kind regards,
Steve
the Telerik team
Yes, the ItemDataBinding event is a valid solution as it would be fired regardless whether the chart has data source set. Here is more info if you are interested:
The chart NeedDataSource event is fired only when the chart does not have data source set. So when in your code you set chart1.DataSource = msList; the chart accepts this as the data source and the event is not fired anymore. The reason is that chart1 is the definition report item i.e. the same as setting data source directly in the designer. When you're in the context of NeedDataSource, you should work with the processing report item instead - more information is available in the Understanding Events help article.
Kind regards,
Steve
the Telerik team