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

Change Report Chart Label and Value

9 Answers 363 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Leandro Mussi Silva
Top achievements
Rank 1
Leandro Mussi Silva asked on 03 Apr 2008, 11:30 PM

I have a table with two columns (description, value) and I would like show description in legend and value in the Pie Chart.

How could I do this?

Thanks

9 Answers, 1 is accepted

Sort by
0
Chavdar
Telerik team
answered on 06 Apr 2008, 06:44 AM
Hello Leandro Mussi Silva,

We have already answered your question in your support ticket. Let us know if you need further assistance on the matter in it.

Sincerely yours,
Chavdar
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Leomar
Top achievements
Rank 1
answered on 11 Jun 2008, 11:18 PM
Hi!!

I have the same exact problem as Leandro, can you repeat for me the solution you gave to him??

Thanks
0
Steve
Telerik team
answered on 12 Jun 2008, 07:16 AM
Hi Leomar,

Here is a sample code snippet which may help you to achieve your requirement:

        DataTable GetTable()
        {
            DataTable table = new DataTable();
            table.Columns.Add("Description", typeof(string));
            table.Columns.Add("Value", typeof(double));

            table.Rows.Add(new object[] { "Item 1", 10 });
            table.Rows.Add(new object[] { "Item 2", 20 });
            table.Rows.Add(new object[] { "Item 3", 30 });
            return table;
           
        }
       
        private void chart1_NeedDataSource(object sender, System.EventArgs e)
        {
            this.chart1.Series.Clear();
            ChartSeries s = new ChartSeries();
            s.Type = ChartSeriesType.Pie;
            s.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
            this.chart1.Series.Add(s);

            DataTable table = this.GetTable();
            foreach (DataRow row in table.Rows)
            {
                ChartSeriesItem item = new ChartSeriesItem();
                item.YValue = (double) row["Value"];
                item.Name = (string) row["Description"];
                s.AddItem(item);
            }
        }

Give it a try and let us know if further help is needed.


Regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Leomar
Top achievements
Rank 1
answered on 13 Jun 2008, 01:34 AM
Hi friends!

Unfortunately I had no luck with the code snippet that you provided, when I used it the chart displays a Pie Chart with the desired data, but the chart legend displays:

Item 1
Item 2
Item 3

etc

which is not what I wanted to display, I need the legend to display

User 1
User 2
User 3

etc

Thanks


0
Leomar
Top achievements
Rank 1
answered on 13 Jun 2008, 01:37 AM
IMPORTANT:

In my previous post I forgot to tell that I implemented your code snippet as:

DataTable GetTable()
        {
            DataTable table = new DataTable();
            table.Columns.Add("Description", typeof(string));
            table.Columns.Add("Value", typeof(double));

            table.Rows.Add(new object[] { "User 1", 10 });
            table.Rows.Add(new object[] { "User 2", 20 });
            table.Rows.Add(new object[] { "User 3", 30 });
            return table;
           
        }

so I expected to see those names on the legend but instead the legend appeared as:

Item 1
Item 2
Item 3

etc


Thanks
0
Hrisi
Telerik team
answered on 13 Jun 2008, 10:07 AM
Hi Leomar,

The problem itself is not in the GetTable() method. In the chart1_NeedDataSource(object sender, System.EventArgs e) method a reference to the chart should be retrieved as shown bellow:

        private void chart1_NeedDataSource(object sender, System.EventArgs e)
        {
           
Telerik.Reporting.Processing.Chart chart = sender as Telerik.Reporting.Processing.Chart;
            chart.Series.Clear();
            ChartSeries s = new ChartSeries();
            s.Type = ChartSeriesType.Pie;
            s.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
            chart.Series.Add(s);

            DataTable table = this.GetTable();
            foreach (DataRow row in table.Rows)
            {
                ChartSeriesItem item = new ChartSeriesItem();
                item.YValue = (double) row["Value"];
                item.Name = (string) row["Description"];
                s.AddItem(item);
            }
        }

Hope this helps.

Greetings,
Hrisi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Leomar
Top achievements
Rank 1
answered on 13 Jun 2008, 12:56 PM
Hrisi and Steve,

I managed to solve my requirement by using the SP1 version of the Reporting package, when I posted my problem I was using Q1 2008, after installing the trial version for Q1 2008 SP1 all worked as expected and the legend displayed the way I needed.

Thanks anyway for your helpful responses

Greetings
0
Leomar
Top achievements
Rank 1
answered on 13 Jun 2008, 01:14 PM
Guys on Telerik,

I forgot to ask something, in the Q1 2008 SP1 release notes of the Reporting Package you mention that you added lots of new config parameters for the PDF Rendering Extension, is the help updated with the documentation of those new configuration options?

and I also would like to know if the help in general is updated with more detailed info, I found some topics too difficult to understand because of a lack of documentation in the help, for example the Report Viewer localization topic is well explained in terms of the naming convention but I couldn't find anywhere the documentation of the resource strings that I need to put into the resource files to customize the texts in the Report Viewer, as I said the naming-convention explanation was very good and detailed but when it came to know the names of the resource strings needed to customize the Report Viewer I couldn't find this information, is this fixed in the help system of the SP1 version, or can I find this information somewhere else?

In general I'm very happy with the product and in spite that I'm a freelance developer I'm doing some big efforts to save enough money to buy a license of your product and use it in my applications.

Keep doing that great job and Congratulations, you have very high quality products that really improves the software development.


Greetings
0
Svetoslav
Telerik team
answered on 16 Jun 2008, 07:38 AM
Hi Leomar,

We are happy to hear that the service pack fixed your problems and moreover that you like Telerik's products in general. We are working hard to make our products good enough and it is always nice to hear that we are in the right direction.

The new PDF parameters are described in the Device Information Settings help topic, at PDF-specific rendering extension section.

In order to simplify the ReportViewers' localization we have added the two RESX files to the product's bin folder, usually: c:\Program Files\Telerik\Reporting Q1 2008\bin. Additional information you can find in the Localizing the Telerik Report Viewer KB article.

Once again thank you for the great feedback. We are looking forward to hearing from you.

Best wishes,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Leandro Mussi Silva
Top achievements
Rank 1
Answers by
Chavdar
Telerik team
Leomar
Top achievements
Rank 1
Steve
Telerik team
Hrisi
Telerik team
Svetoslav
Telerik team
Share this question
or