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

[Solved] How to hide the CategoryAxis value when there is to many sample points

4 Answers 46 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Qian
Top achievements
Rank 1
Qian asked on 21 Mar 2012, 04:35 AM
Hi all,
I'm using the Telerik Extension for MVC, Chart -> Line. Everything went well, but I fount a problem. There are too many sample points in my data set (and I do need all these data) and the the axis value in X cannot be seen clearly. I just want to not to show them or is there any other better choice. Can anyone tell me how to do that?
@{
    Html.Telerik().Chart(Model.ProcessorPerfData)
        .Name("processorView")
        .Title("Processor Utilization")
        .Legend(legend => legend.Position(ChartLegendPosition.Bottom))
        .CategoryAxis(axis => axis.Categories(m => m.DateTimeString))
        .Series(s => s.Line(m => m.ProcessorTime).Name("%Processor Time").Width(1).Markers(false))
        .HtmlAttributes(new { style = "width: 700px; height: 280px;" })
        .Render();
}

Please see the screen shot in the attachment.
Thanks !



4 Answers, 1 is accepted

Sort by
0
Ryan Behan
Top achievements
Rank 1
answered on 21 Mar 2012, 04:46 AM
Qian,
   Add the following to your categories setup.

.CategoryAxis(axis => axis.Categories(m => m.DateTimeString)
.Labels(false)
)
you could optionally add
.Tooltip(tooltip => tooltip
                    .Template("<#= category #> - <#= value #>")
                    .Visible(true))

So you can mouse over the data points in some cases to see a value, may not be as helpful in your case.

-Ryan
0
Qian
Top achievements
Rank 1
answered on 21 Mar 2012, 05:21 AM
Thanks for you suggestion, but I added Label(false) to my code and it didn't work
@{
    Html.Telerik().Chart(Model.ProcessorPerfData)
        .Name("processorView")
        .Title("Processor Utilization")
        .Legend(legend => legend.Position(ChartLegendPosition.Bottom))
        .CategoryAxis(axis => axis.Categories(m => m.DateTimeString).Labels(false))
        .Series(s => s.Line(m => m.ProcessorTime).Name("%Processor Time").Width(1).Markers(false))
        .HtmlAttributes(new { style = "width: 700px; height: 280px;" })
        .Render();
}

I've tried to clean up the cache in the IE. Do you have any idea what may be the cause?
Thanks
0
Accepted
Ryan Behan
Top achievements
Rank 1
answered on 21 Mar 2012, 02:08 PM
Qian,
    2 suggestions at this time.

1)  I know you've stated you've addressed browser cache.  Have you reproduced in another browser, chrome, FF, safari?  
2)  You could make all the elements in your category an empty string, that might hack it.

-Ryan
0
Iliana Dyankova
Telerik team
answered on 23 Mar 2012, 08:54 AM
Hello,

It is possible Labels(false) option not to work properly in previous versions - we've had a problem, but it was fixed. Could you please try with Q1 release?
As another solution I could suggest to use Labels Step() in order to prevent overlaping of the Category labels and skip some of them.
For example:
.CategoryAxis(axis => axis.Categories(catLabels).Labels(labels => labels.Step(5))


 
Kind regards,
Iliana Nikolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
Chart
Asked by
Qian
Top achievements
Rank 1
Answers by
Ryan Behan
Top achievements
Rank 1
Qian
Top achievements
Rank 1
Iliana Dyankova
Telerik team
Share this question
or