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

ChartsLabelBuilderBase VisibleHandler

2 Answers 21 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Pawel Ch
Top achievements
Rank 1
Pawel Ch asked on 04 Apr 2017, 08:08 AM

Hi,

How does it actually work? I mean Kendo.Mvc.UI.Fluent.ChartLabelsBuilderBase.VisibleHandler() method. and how a handler used as the parameter should be implemented/used. I would expect that such a handler returns true or false and controls associated labels visible attribute but I couldnt achieve this.

see a part of my code below...

 

series
.Column("StatsFaultsInInspections", "ARGB_RiskColorHexString", "RiskLevelName")
     .Labels(x => x.Position(ChartBarLabelsPosition.OutsideEnd)                                   
     .Visible(true)  
     .Template("#= value # Tags\\n\\r#= kendo.format('{0:n2}', dataItem.StatsFaultsInInspectionsPercentOfInSameRisk) #%")
     .VisibleHandler("labelsVisibility")
)
.Name("Tags with faults");

 

2 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 05 Apr 2017, 03:20 PM
Hi Pawel,

As the documentation states, VisibleHandler accepts a String value, which represents the name of the function, which will determine the labels visibility (by returning true or false). So, if I set:
.Series(series => {
    series
        .Column(new double[] { 3.907, 7.943, 7.848, 9.284, 9.263, 9.801, 3.890, 8.238, 9.552, 6.855 })
        .Name("India")
        .Labels(labels => labels
        .VisibleHandler("getIsVisible"));

and then write the following JavaScript function, my labels will be visible:
<script>
    function getIsVisible() {
        // .... logic
        return true;
    }
</script>

In your case, I see that you have applied both Visible and VisibilityHandler, which, I assume, results in a conflict. Make sure you use only one of the two methods.

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Pawel Ch
Top achievements
Rank 1
answered on 05 Apr 2017, 07:25 PM

Hi and thank you for the answer.

My handler function implementation was more less the same (with true or false retured depending on some other component size). I just pressed "POST" before finish with JS code insertion. But, anyway...

The problem, was as you wrote with usage of Visible and VisibleHandler methods together.

With usage of only VisibleHandler visibility of labels is controled properly.

 

Tags
Chart
Asked by
Pawel Ch
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Pawel Ch
Top achievements
Rank 1
Share this question
or