Too many legend items in Kendo chart

4 posts, 0 answers
  1. robin
    robin avatar
    3 posts
    Member since:
    Apr 2015

    Posted 16 Jul 2015 Link to this post

    Hi. I have the following chart...

     

    $("#chart").kendoChart({
                //datasource
                //chartArea: {
                //    background: "#282828"
                //},
                //legend: { visible: false },
                seriesClick: onSeriesClick,
                render: onRender,
                dataSource: { transport: { read: { url: sUrl, type: "get" } }, sort: [{ field: "Tunit", dir: "asc" }, { field: "SelGrp", dir: "asc" }], group: { field: "SelGrp" } },
                title: { text: "Statistics" },

                legend: { position: "top" },



                series: [
                            { field: "AvgBitRateInS", categoryField: "Tunit", missingValues: "gap",visibleInLegend: sTorF, name: "AvgBitRate In (Kb/s)", type: "line", style: "smooth", axis: "BitRateIn", hidden: "HideIn", tooltip: { visible: true, template: "#= dataItem.SelGrp #<br/>${category}<br/>  AvgBitRate In - ${value} (Kb/s)" }, },
                            { field: "AvgBitRateOutS", categoryField: "Tunit", missingValues: "gap",visibleInLegend: true, name: "AvgBitRate Out (Kb/s)", type: "line", style: "smooth", axis: "BitRateOut", hidden: "HideOut", tooltip: { visible: true, template: "#= dataItem.SelGrp #<br/>${category}<br/>  AvgBitRate Out - ${value} (Kb/s)" }, },
                            { field: "Drops", categoryField: "Tunit", visibleInLegend: false, name: "Drops", colorField: "userColor", type: "column", axis: "Drops", tooltip: { visible: true, template: "#= dataItem.SelGrp #<br/>${category}<br/>Drops - ${value}" } }

                ],

                categoryAxis: {
                    axisCrossingValues: [999999,999999, 0],
                    justified: true,
                    //field: "Tunit",
                    labels: { rotation: -90 }
                },



                valueAxes: [
                    {
                        name: "BitRateIn",
                        title: { text: "Avg Bitrate In" },
                        color : "green"
                    },
                    {
                        name: "BitRateOut",
                        title: { text : "Avg Bitrate Out"},
                        color : "olive"
                    },
                    {
                        name: "Drops",
                        title: { text: "Drops" },
                        color : "red" 
                        

                    }
                     ]

            });

     

     

    The datasource returns the following json

    [
        {
            "BlueLabelId": 528,
            "StreamInterfaceId": 16,
            "Timestamp": "0001-01-01T00:00:00",
            "StreamMode": "receiver",
            "SourceAddress": null,
            "SourcePort": 0,
            "SinkAddress": null,
            "SinkPort": 0,
            "Drops": 66017,
            "Bitrate": 0,
            "BitrateIn": 0,
            "BitrateOut": 0,
            "ResendCounter": 0,
            "RudPrtt": 0,
            "PathName": null,
            "LinkDrops": 0,
            "PathNumber": 1,
            "Year": null,
            "Month": null,
            "Day": null,
            "Hour": null,
            "Minute": null,
            "Second": null,
            "Tmax": null,
            "Tunit": "2015 Jul 09",
            "AvgBitRate": 0,
            "AvgBitRateIn": 0,
            "AvgBitRateOut": 0,
            "SelGrp": "528/16/1/receiver",
            "AvgBitRateInS": "0",
            "AvgBitRateOutS": null,
            "userColor": "#FF0000"
        },
        {
            "BlueLabelId": 528,
            "StreamInterfaceId": 16,
            "Timestamp": "0001-01-01T00:00:00",
            "StreamMode": "receiver",
            "SourceAddress": null,
            "SourcePort": 0,
            "SinkAddress": null,
            "SinkPort": 0,
            "Drops": 0,
            "Bitrate": 0,
            "BitrateIn": 0,
            "BitrateOut": 0,
            "ResendCounter": 0,
            "RudPrtt": 0,
            "PathName": null,
            "LinkDrops": 0,
            "PathNumber": 100,
            "Year": null,
            "Month": null,
            "Day": null,
            "Hour": null,
            "Minute": null,
            "Second": null,
            "Tmax": null,
            "Tunit": "2015 Jul 09",
            "AvgBitRate": 0,
            "AvgBitRateIn": 0,
            "AvgBitRateOut": 14289,
            "SelGrp": "528/16/100/receiver",
            "AvgBitRateInS": null,
            "AvgBitRateOutS": "14289",
            "userColor": "#FF0000"
        },
        {
            "BlueLabelId": 528,
            "StreamInterfaceId": 16,
            "Timestamp": "0001-01-01T00:00:00",
            "StreamMode": "receiver",
            "SourceAddress": null,
            "SourcePort": 0,
            "SinkAddress": null,
            "SinkPort": 0,
            "Drops": 0.000001,
            "Bitrate": 0,
            "BitrateIn": 0,
            "BitrateOut": 0,
            "ResendCounter": 0,
            "RudPrtt": 0,
            "PathName": null,
            "LinkDrops": 0,
            "PathNumber": 1,
            "Year": null,
            "Month": null,
            "Day": null,
            "Hour": null,
            "Minute": null,
            "Second": null,
            "Tmax": null,
            "Tunit": "2015 Jul 10",
            "AvgBitRate": 0,
            "AvgBitRateIn": 15960,
            "AvgBitRateOut": 0,
            "SelGrp": "528/16/1/receiver",
            "AvgBitRateInS": "15960",
            "AvgBitRateOutS": null,
            "userColor": "#FF0000"
        },
        {
            "BlueLabelId": 528,
            "StreamInterfaceId": 16,
            "Timestamp": "0001-01-01T00:00:00",
            "StreamMode": "receiver",
            "SourceAddress": null,
            "SourcePort": 0,
            "SinkAddress": null,
            "SinkPort": 0,
            "Drops": 0,
            "Bitrate": 0,
            "BitrateIn": 0,
            "BitrateOut": 0,
            "ResendCounter": 0,
            "RudPrtt": 0,
            "PathName": null,
            "LinkDrops": 0,
            "PathNumber": 100,
            "Year": null,
            "Month": null,
            "Day": null,
            "Hour": null,
            "Minute": null,
            "Second": null,
            "Tmax": null,
            "Tunit": "2015 Jul 10",
            "AvgBitRate": 0,
            "AvgBitRateIn": 0,
            "AvgBitRateOut": 14289,
            "SelGrp": "528/16/100/receiver",
            "AvgBitRateInS": null,
            "AvgBitRateOutS": "14289",
            "userColor": "#FF0000"
        }
    ]

     

    (Little info. The pathnumber 100 is a summary. It is not a selected item, but is used when showing BitRateIn for a transmitter and BitRateOut for a receiver - I am using AvgBitRateInS / AvfBitRateOutS so I can return a "null" which should hide the non relevant info. For "Drops" I am returning zero (0) in order to hide relevant data.)

    For some reason I still get a legend as shown.

    How can I make the non-necessary 528/16/receiver :AvgBitRate In and 528/16/receiver Drops    NOT show in the legend?

  2. robin
    robin avatar
    3 posts
    Member since:
    Apr 2015

    Posted 16 Jul 2015 in reply to robin Link to this post

    *edit.

    Forget the drops legend, the above "visibleInLegend" gets rid of that . But I can't use that for the bitrate fields as far as I can see.

  3. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 21 Jul 2015 Link to this post

    Hello Robin,

    Thank you for posting to the Telerik Developer forums.

    You have submitted your support inquiry for Telerik Kendo UI Professional under the Telerik AppBuilder forums. I am afraid that Telerik AppBuilder forums does not include support for the product you are using and we cannot provide a resolution for your technical question. That is why I'd suggest that you consult the Kendo UI forums or the referenced there community resources. Also, if you company holds a license for Kendo UI Professional, please, contact the license holder to submit a support ticket for the appropriate product.

    Regards,
    Anton Dobrev
    Telerik
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  4. robin
    robin avatar
    3 posts
    Member since:
    Apr 2015

    Posted 21 Jul 2015 in reply to Anton Dobrev Link to this post

    Thanks, I realised after I posted that it was in the wrong place. However I have fixed the issue in the datasource now so it is no longer relevant.

    Cheers.

    robin.

Back to Top