Hide Data Point Label

10 posts, 2 answers
  1. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 27 Aug 2010 Link to this post

    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

  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 27 Aug 2010 Link to this post

    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
  3. DevCraft banner
  4. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 27 Aug 2010 Link to this post

    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

  5. Answer
    Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 27 Aug 2010 Link to this post

    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
  6. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 28 Aug 2010 Link to this post

    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();

  7. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 01 Sep 2010 Link to this post

    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
  8. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 01 Sep 2010 Link to this post

    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
  9. Answer
    Ves
    Admin
    Ves avatar
    2879 posts

    Posted 03 Sep 2010 Link to this post

    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
  10. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 03 Sep 2010 Link to this post

    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

  11. Richard
    Richard avatar
    72 posts
    Member since:
    Feb 2009

    Posted 03 Sep 2010 Link to this post

    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

Back to Top
DevCraft banner