最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - display value of series and y axis data together in tooltip template kendo UI - Stack Overflow

programmeradmin0浏览0评论

I am using kendo UI Bar chart to display some data. I am able to display the column chart..

But I have some concern If any body can help.

  1. I don't want ant gap between low voltage data bar and high voltage data bar
  2. How to display value of series and y axis data together in tooltip template

I want it to be

Please find attached images for reference..

My code:

title: {
},
legend: {
    position: "bottom"
},
seriesDefaults: {
    type: "column",
//stack: true
},
series: [{
    name: "# Low Voltage Service Points",
    data: [50, 23, 74, 20, 20, 10],
    color: "#1A5FED",

    // Line chart marker type
    markers: {
        type: "square"
    }
}, {
    name: "# High Voltage Service Points",
    data: [52, 34, 78, 68, 23, 40],
    color: "#ed3024",
}],
valueAxis: {
    line: {
        visible: false
    },
    labels: {
    //format: "{0}%"
    },
    axisCrossingValue: 0
},
categoryAxis: {
    categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
    color: "#ff0000",
    majorGridLines: {
        visible: false
    },
    line: {
        visible: false
    },
    labels: {
        template: "#=categories[value]#"
    },
},
tooltip: {
    visible: true,
    format: "{0}",
    template: "#= series.name #: #= value #, Date"
}

My code is working fine..

Thanks!!

I am using kendo UI Bar chart to display some data. I am able to display the column chart..

But I have some concern If any body can help.

  1. I don't want ant gap between low voltage data bar and high voltage data bar
  2. How to display value of series and y axis data together in tooltip template

I want it to be

Please find attached images for reference..

My code:

title: {
},
legend: {
    position: "bottom"
},
seriesDefaults: {
    type: "column",
//stack: true
},
series: [{
    name: "# Low Voltage Service Points",
    data: [50, 23, 74, 20, 20, 10],
    color: "#1A5FED",

    // Line chart marker type
    markers: {
        type: "square"
    }
}, {
    name: "# High Voltage Service Points",
    data: [52, 34, 78, 68, 23, 40],
    color: "#ed3024",
}],
valueAxis: {
    line: {
        visible: false
    },
    labels: {
    //format: "{0}%"
    },
    axisCrossingValue: 0
},
categoryAxis: {
    categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
    color: "#ff0000",
    majorGridLines: {
        visible: false
    },
    line: {
        visible: false
    },
    labels: {
        template: "#=categories[value]#"
    },
},
tooltip: {
    visible: true,
    format: "{0}",
    template: "#= series.name #: #= value #, Date"
}

My code is working fine..

Thanks!!

Share Improve this question edited Sep 11, 2014 at 11:06 Adrian Forsius 1,4382 gold badges19 silver badges29 bronze badges asked Sep 11, 2014 at 10:51 FrontEnd ExpertFrontEnd Expert 5,81510 gold badges63 silver badges100 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

To avoid spaces use "spacing" parameter in the series

series: [{
        spacing: 0,
}]

to show the category value in the tooltip use this #= category #

 template: "#= series.name #: #= category # = #= value # "

I have Done a Jsfidle Example so you can see it in action

http://jsfiddle/chanaka1/hy7uqu00/2/

Hope this helps.

发布评论

评论列表(0)

  1. 暂无评论