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

No idea where to start with charts

6 Answers 124 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Terry
Top achievements
Rank 1
Terry asked on 16 Apr 2012, 08:58 PM
I have tried reading the documentation provided and searching online, but  i have no idea where to start when it comes to a chart.  I have a sql query generating a report in VS 2010 connecting to a sqldatasource.  I want to create a chart but cannot seem to get it to work properly.  Does anyone know of a good guide or place to get an overview or a video to watch on how this works from start to finish, even on a simple example.  I think once i get the idea i can extrapolate from there. thanks for the help.

6 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 17 Apr 2012, 04:37 PM
Hi Steven,

Our suggestion is to start with the Working with Charts in Telerik Reports video. After that you can go ahead and check the Chart online documentation.

Also you can check our online examples and watch the videos related to them and specifically the charts implementations.

Regards,

Petio Petkov
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Terry
Top achievements
Rank 1
answered on 17 Apr 2012, 10:50 PM
thank you, that did help a lot.  Im running into one huccip though when trying to populate the legend of a pie chart with what i want it to display.  The query im using returns two columns one column titles Delivery Status which returns Past Due, ON time, etc.  the other is a count of that same column which then tells me how many orders are in each of the categories.  See below for the full query.  When i reverse this "Select COUNT(DeliveryStatus), DeliveryStatus....."  to "Select DeliveryStatus, COUNT(DeliveryStatus)...." i get this error. "an error has occured while processing chart 'chart1: the type of column with name delivery status is not numeric" is there a way to get this query to return what i need? My ultimate goal is to match up the legend of the pie chart to the delivery status column so each pie portion refers to past due, on time, etc.



Select COUNT(DeliveryStatus), DeliveryStatus 
FROM (SELECT cl.Name as Client, 




CASE 
WHEN dbo.TruncateDate(CURRENT_TIMESTAMP) = dbo.TruncateDate(oi.RequiredByDate) THEN 'Due Today'
WHEN CURRENT_TIMESTAMP > oi.RequiredByDate THEN 'Past Due'
WHEN DATEADD(dd, DATEDIFF(dd, 0, oi.RequiredByDate), 0) = dateadd(day, datediff(day, '19000101',CURRENT_TIMESTAMP),'19000102') then 'Due Tomorrow'
WHEN DateDiff(day, getdate(), RequiredByDate) BETWEEN 2 and 7 AND DateName(weekday, RequiredByDate) = 'Monday' Then 'Due Monday'
ELSE 'Due Beyond' end
as DeliveryStatus

FROM OrderItems oi
JOIN Orders o ON o.OrderID = oi.OrderID
JOIN Counties c ON c.FIPS = o.FIPS
JOIN Clients cl ON cl.ClientID = o.ClientID
JOIN Milestones m ON m.MilestoneID = oi.LastMilestoneID
JOIN Products p ON p.ProductID = oi.ProductID
JOIN Vendors v ON v.VendorID = oi.VendorID
LEFT JOIN ClientBranches clb ON clb.ClientID = o.ClientID
WHERE QueueID > 0
and cl.Name not like ('Tes%')) as Pie

GROUP BY DeliveryStatus
0
Terry
Top achievements
Rank 1
answered on 17 Apr 2012, 11:29 PM
Hi to add, ive been trying to get this to work as i think it is what i need, but with limited coding experience im not sure what goes where in reference to my report specifics. Is this what i need? if so how can i connect that to what i have?


  • private void MyChart_NeedDataSource(object sender, EventArgs e)
            {
                Telerik.Reporting.Processing.Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
                string sql = @"SELECT [Market],[Signups] FROM ...";
                string connectionString = "Data Source=Servername;Initial Catalog=DBName;Integrated Security=True";
                SqlDataAdapter adapter = new SqlDataAdapter(sql, connectionString);
                DataSet dataSet = new DataSet();
                adapter.Fill(dataSet);
                Telerik.Reporting.Chart defChart = (Telerik.Reporting.Chart)procChart.ItemDefinition;
                defChart.IntelligentLabelsEnabled = false;
                ChartSeries serie = new ChartSeries();
                serie.Type = ChartSeriesType.Pie;
                serie.Clear();
                serie.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
                serie.Appearance.ShowLabelConnectors = true;
                foreach (DataRow dr in dataSet.Tables[0].Rows)
                {   
                    ChartSeriesItem item = new ChartSeriesItem();
                    item.YValue = Convert.ToDouble(dr["Signups"]);
                    item.Name = (string)dr["Market"];
                    item.Appearance.Exploded = true;
                    item.Label.TextBlock.Text = dr["Signups"].ToString();
                    serie.Items.Add(item);
                }
                defChart.Series.Add(serie); 
      
      
            }
0
Petio Petkov
Telerik team
answered on 18 Apr 2012, 05:10 PM
Hi,

You don't need to program anything for now. I think that you can achieve your goal only from the Reporting Designer.
Firstly, you should modify your DataSource query to be something like the following one:
Select COUNT(DeliveryStatus) AS DSCount, DeliveryStatus
..........
GROUP BY DeliveryStatus
After that, set the RadChart's DefaultType property to Pie.
After that add a new  Series(Series1) in the RadChart's series collection. Set the Series1's DataLabelsColumn property  to DeliveryStatus, DataYColumn to DSCount and Type to Pie.

In case that this suggestion doesn't help you, please describe your goal in more details.

All the best,
Petio Petkov
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
0
Narender
Top achievements
Rank 1
answered on 18 Feb 2014, 05:12 PM
Hello Petio,

I have the same problem with Stacked Bar Chart.
 Error: " an error has occured while processing chart 'chart1: the type of column with name COST is not numeric".
I tried all the ways that I found on Internet. I finally tried the way you explained. 

(Set the RadChart's DefaultType property to Stacked Bar.
After that add a new  Series(Series1) in the RadChart's series collection. I don't need the Series1's DataLabelsColumn property. DataYColumn to COST and Type to Stacked Bar.)

But there is no use and I still get the same error.
My query returns a column COST which is a decimal. I tried casting it to different datatypes but there is no use.
Can you please suggest me a solution or let me know If you need more information?
 I don't prefer to do it programmatically unless it is impossible via Design.

Thanks in advance,
Sara.


0
Nasko
Telerik team
answered on 20 Feb 2014, 05:09 PM
Hello Narender,

Note that there is no RadChart item in Telerik Reporting. For more information on the Telerik Reporting items, check the Reporting Structure help article.
If you are referring to the Chart item in your post, then keep in mind the Chart item is obsolete and is no longer supported. We recommend that you switch to the new and more advanced Graph item instead.

Additionally, it would be of great help for us if you can open a support ticket, where you can zip and attach a sample report definition exhibiting the described issue. Once we review it, we would be able to provide you with more information.

Regards,
Nasko
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

Tags
General Discussions
Asked by
Terry
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Terry
Top achievements
Rank 1
Narender
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or