ChartsLabelBuilderBase VisibleHandler

3 posts, 0 answers
  1. Pawel Ch
    Pawel Ch avatar
    6 posts
    Member since:
    May 2015

    Posted 04 Apr Link to this post

    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. Tsvetina
    Admin
    Tsvetina avatar
    2076 posts

    Posted 05 Apr Link to this post

    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.
  3. Pawel Ch
    Pawel Ch avatar
    6 posts
    Member since:
    May 2015

    Posted 05 Apr in reply to Tsvetina Link to this post

    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.

     

Back to Top