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

Too many legend items in Kendo chart

3 Answers 136 Views
Show your code
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
robin
Top achievements
Rank 1
robin asked on 16 Jul 2015, 11:41 AM

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?

3 Answers, 1 is accepted

Sort by
0
robin
Top achievements
Rank 1
answered on 16 Jul 2015, 11:43 AM

*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.

0
Anton Dobrev
Telerik team
answered on 21 Jul 2015, 08:23 AM
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.

 
0
robin
Top achievements
Rank 1
answered on 21 Jul 2015, 08:36 AM

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.

Tags
Show your code
Asked by
robin
Top achievements
Rank 1
Answers by
robin
Top achievements
Rank 1
Anton Dobrev
Telerik team
Share this question
or