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
You need to set the LineSeriesDefinition.ShowItemLabels and LineSeriesDefinition.ShowPointMarks properties to false.
Hope this helps.
Best wishes,
Freddie
the Telerik team
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
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
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();
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
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
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
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
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