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

How to disable datapoints display in bar graph

5 Answers 216 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Saravanan
Top achievements
Rank 1
Saravanan asked on 28 Feb 2012, 06:43 AM

Hello All,
    I am creating a bar chart. The datasource is a datatable having values. The X-Axis has the date and the Y-Axis has values. When done this way the Datapoints are being displayed on top of each bar. I do not want to display the Datapoint value. How do I disable this? I had check the example they had given "
chartSeries.Appearance.LabelAppearance.Visible = false;"(doesnot support). Is there any way the I can remove the datapoints.
    Any how I am able to disable if I create series and populate by giving " chart1.Series[1].Appearance.LabelAppearance.Visible = false;" but the problem in this is that I am not able to populate the X-axis with date it asks for a double " item1.XValue = Convert.ToDateTime(TableValues.Rows[i]["StartTime"]).ToOADate();" in this the displayvalue in the chart comes as year 1899, the value passed was “
TableValues.Rows[i]["StartTime"]= 2011-11-10 17:10:00". How do I plot values for relevant date?

 

Code:

Telerik.Reporting.Charting.ChartSeries chartSeries1 = new Telerik.Reporting.Charting.ChartSeries();

            for (int i = 0; i < TableValues.Rows.Count; i++)

            {

                Telerik.Reporting.Charting.ChartSeriesItem item1 = new Telerik.Reporting.Charting.ChartSeriesItem();

                item1.YValue = Convert.ToDouble(TableValues.Rows[i]["AlarmCount"]);

                item1.XValue = Convert.ToDateTime(TableValues.Rows[i]["StartTime"]).ToOADate();

 

                chartSeries1.Items.Add(item1);

            }

 

            this.InitiatedChart.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] {

            chartSeries1});

 

       The other is that what is the max number of values the graph can hold. The graph does not display for 16,000 points.


I am using visual studio 2010, Telerik Reporting (licensed -TV446243)

5 Answers, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 01 Mar 2012, 04:55 PM
Hi Saravanan,

To your first question, creating the series manually is the only way to solve this issue. 
As to the dates, you need to adjust the XAxis min/max values, so that the range value is matches your data. Here's a sample code achieving that:

//adjust the y-axis
chart.PlotArea.XAxis.AutoScale = false;
chart.PlotArea.XAxis.MinValue = startDate.ToOADate();
chart.PlotArea.XAxis.MaxValue = endDate.ToOADate();
//this sets the format for the labels on the axis
chart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.ShortDate;
//If your date range is big, widen the step to avoid overcrowding
chart.PlotArea.XAxis.Step = 10;

The chart is not built to handle large amounts of data, because that doesn't make sense in common scenarios. Usually the chart is used with 1-100 visible items. 

Regards,
Elian
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
Saravanan
Top achievements
Rank 1
answered on 02 Mar 2012, 05:40 AM
Hello Elian,
    Thank you for the reply.
    I had tried the manually loading of the data. The problem is that when i populate in report for example 1 day (11/11/2011) the values starts to get populated before the marking in the x-axis. Below is the error image containing all the images.

Image 1: Displays the actual graph. In application.
Image 2: Shows graph in report viewer. If you see the first bar is before the date in XAxis.
Code:

this

.InitiatedChart.PlotArea.XAxis.AutoScale = false;

InitiatedChart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.ShortDate;

InitiatedChart.PlotArea.XAxis.MinValue = Convert.ToDateTime(FromDate).ToOADate();

InitiatedChart.PlotArea.XAxis.MaxValue = Convert.ToDateTime(ToDate).ToOADate();

 

Telerik.Reporting.Charting.ChartSeries chartSeries1 = new Telerik.Reporting.Charting.ChartSeries();

  

for (int i = 0; i < TableValues.Rows.Count; i++)

 {

Telerik.Reporting.Charting.ChartSeriesItem item1 = new Telerik.Reporting.Charting.ChartSeriesItem();  

item1.YValue = Convert.ToDouble(TableValues.Rows[i]["AlarmCount"]);  

item1.XValue = Convert.ToDateTime(TableValues.Rows[i]["StartTime"]).ToOADate();

 

chartSeries1.Items.Add(item1);

}

 

this.InitiatedChart.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] {

 chartSeries1});

InitiatedChart.Series[0].Name = TableValues.Columns["AlarmCount"].ColumnName;

InitiatedChart.Series[0].Appearance.BarWidthPercent = 4;

InitiatedChart.Series[0].Appearance.LabelAppearance.Visible = false;

In the other picture attachment You can find the graph lines over lapping each other in the export option of pdf since it take only date format but in this case 1 date has multiple values with different time constraint.

I am using visual studio 2010, Telerik Reporting (licensed -TV446243)

* In earlier post I had mentioned duplicate series created it was due to the reason that the NeedDataSource was called for the second time when exported but it did not cause problem when done "Datasource = datatable".

Regards,
Saravanan.R

0
Elian
Telerik team
answered on 06 Mar 2012, 03:57 PM
Hi Saravanan,

We cannot determine the exact issue from the screenshots alone, however it is highly likely to have issues, because the period is 24 hours and the difference in time between the items is 1 hour, which is very small compared to the whole time span. 
You can open a support ticket and attach a runnable project that we can test for possible solutions. 

Regards,
Elian
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
Saravanan
Top achievements
Rank 1
answered on 07 Mar 2012, 01:36 PM
Hello Elian,
    I had posted a support ticket with demo application. Ticket ID: 520072 . The exact values can be checked in below image. There are 3 pictures
1. How it displays in application
2. The other in the telerik manual series creation. (Value barchart displays before date)
3. When populated " DataSource = dataTable".

The 3rd way it displays correctly.

Regards,
Saravanan.R
0
Saravanan
Top achievements
Rank 1
answered on 15 Mar 2012, 06:39 AM
Hello Elian,
Thank you for the Reply. I was able to solve the issues.
The basic is that the steps are equivalent to day's. Like Step 1 = 1 day, Step 2 = 2 days. Meaning for the first there would be difference of 1 day and the second would be 2 days and so on. if we need in hours it would be (1.0/24) will get split for each hour and for each 10 min it would be 1.0 / (60 * 24 / 10) (60 = 60 min in 1 hour, 24 = hours in a day, 10 = the time interval needed to display). If need a intervel of 20 min then divide by 20, now i divide by 10 since i need intervel of 10min.

Regards,
Saravanan.R
Tags
General Discussions
Asked by
Saravanan
Top achievements
Rank 1
Answers by
Elian
Telerik team
Saravanan
Top achievements
Rank 1
Share this question
or