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

Hide Data Point Label

9 Answers 204 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Richard asked on 27 Aug 2010, 03:57 PM

Hi,


I have a chart control with a few line series on it.  For one particular series I don’t what to show any label or point marks.  Just a single clean unbroken line across the chart.


Any ideas on how to do this ?


Thanks,

Richard

9 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 27 Aug 2010, 04:54 PM
Hi Richard,

You need to set the LineSeriesDefinition.ShowItemLabels and LineSeriesDefinition.ShowPointMarks properties to false.

Hope this helps.


Best wishes,
Freddie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 27 Aug 2010, 05:10 PM
Thanks Freddie

Do you mean like this?

DataSeries lineSeries = new DataSeries();
lineSeries .LegendLabel = "TEST";
lineSeries .Definition = new LineSeriesDefinition();
lineSeries .Definition.ShowItemLabels = false;
 
lineSeries .Definition.ShowPointMarks 


it's just that ShowPointMarks  does not seem to be an available property ?


Cheers,
Richard

0
Accepted
Giuseppe
Telerik team
answered on 27 Aug 2010, 05:48 PM
Hello Richard,

The type of DataSeries.Definition is the base interface ISeriesDefinition that does not contain ShowPointMarks property -- try it like this:

DataSeries lineSeries = new DataSeries();
lineSeries.LegendLabel = "TEST";
lineSeries.Definition = new LineSeriesDefinition();
lineSeries.Definition.ShowItemLabels = false;
(lineSeries.Definition as LineSeriesDefinition).ShowPointMarks = false;

Hope this helps.


All the best,
Freddie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 28 Aug 2010, 01:01 PM
That's great, worked perfectly, thank you.

 If you don't mind I have one follow up question on the chart control.

I'm charting weekly totals and use the AxisX.Step = 7 so that displayed dates appear 1 week apart. 
Is there away to control the value of the first displayed date on the x axis? what I need is for each date displayed to be a Friday.

I thought I might be able to control it via the AxisX.MinValue, but no matter that I set the MinValue to the displayed dates on the chart are always Tuesday ? 

In the example below "startDate" is set earlier in the code to first date of of my data set. 

this.chartProcessHistory.DefaultView.ChartArea.AxisX.IsDateTime = true;
this.chartProcessHistory.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "dd-MMM";
this.chartProcessHistory.DefaultView.ChartArea.AxisX.AutoRange = false;
this.chartProcessHistory.DefaultView.ChartArea.AxisX.Step = 7;
 
while (startDate.DayOfWeek != DayOfWeek.Friday)  startDate = startDate.AddDays(-1);
this.chartProcessHistory.DefaultView.ChartArea.AxisX.MinValue = startDate.ToOADate();
this.chartProcessHistory.DefaultView.ChartArea.AxisX.MaxValue = DateTime.Now.AddDays(3).ToOADate();

0
Ves
Telerik team
answered on 01 Sep 2010, 08:37 AM
Hi Richard,

This seems to work correctly for me. You can find attached a small example, based on your code. I have also attached a screenshot of the resulting chart. Give this page a try and let us know if it works as expected.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 01 Sep 2010, 10:30 AM

Hi Ves,

 I tried your example and sure enough it started on a Friday. I was confused as to why this works for your code and not in mine so I tried changing the (startDate.DayOfWeek != DayOfWeek.Friday) to every possible day of the week.

Here's what I got... 
DayOfWeek.         Displayed Date               Day of Week
Monday                10th                                 Friday
Tuesday               17th                                 Friday
Wednesday          17th                                 Friday
Thursday             17th                                  Friday
Friday                  10th                                  Friday
Saturday              10th                                  Friday
Sunday                10th                                  Friday

My original problem was that I could not get the chart to display any start date other than a Tuesday . In your example code I can’t get it to display any start date other than a Friday …..  ? .

What actually determines the first date that is displayed on the XAxis ?


Thanks,
Richard
0
Accepted
Ves
Telerik team
answered on 03 Sep 2010, 10:58 AM
Hello Richard,

I am really surprised  -- this behavior is not observed at my end. I have attached an updated version of my example, now you can select the reference day in a listbox - the chart updates correctly.

Onto your question -- "What actually determines the first date that is displayed on the XAxis ?" It is actually determined by the line next to the while loop:
this.chartProcessHistory.DefaultView.ChartArea.AxisX.MinValue = startDate.ToOADate();
and the startDate in this line is correctly (after me) calculated by that loop

As a side note -- please, make sure you use the latest version of RadCotrols for Silverlight -- currently Q2 2010 SP1, file version 2010.2.812.1040.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 03 Sep 2010, 12:26 PM

Hi Ves,


This is really strange,  I have tried your latest code and it works, when I pick a day from the list box the chart updates to the correct day. However if I manually set the day in code. ie  change your code to ..


while (startDate.DayOfWeek != DayOfWeek.Thursday) startDate = startDate.AddDays(-1);
//while (startDate.DayOfWeek != ReferenceDay) startDate = startDate.AddDays(-1);
this.chartProcessHistory.DefaultView.ChartArea.AxisX.MinValue = startDate.ToOADate();
this.chartProcessHistory.DefaultView.ChartArea.AxisX.MaxValue = DateTime.Now.AddDays(3).ToOADate();


It stops working and goes back to the results in my post above (no matter what day I pick the chart starts on a Friday)… ? 

Does it happen for you if you hard code the day rather than use the dynamic list box ?


I have tried displaying a message box of the computed startDate after the while loop and it correctly displays the startDate as a mon, tue, wed etc.

Thanks for your time on this, I'm really confused.

Richard

0
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 03 Sep 2010, 12:32 PM

Oh hold on a minute, I have just done an update. Going from 2010.2.714.1040  ->  2010.2.812.1040  and it has fixed it ! ?


I don’t understand how but now your code and mine work with a hardcoded day !!


Thank you so much for your help.

Richard

Tags
Chart
Asked by
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Answers by
Giuseppe
Telerik team
Richard
Top achievements
Rank 2
Iron
Veteran
Iron
Ves
Telerik team
Share this question
or