ChartJS 我需要分组堆叠条形图在compate今年和去年的数据与类别明智的计数显示在图表中

dgtucam1  于 2022-11-23  发布在  Chart.js
关注(0)|答案(1)|浏览(147)

我想在Jquery下图所示的图表,我已经尝试了很多代码,但无法实现它,我可以张贴的代码,我已经尝试过,但它的价值较低。

在图表中,我们试图比较过去两年按类别划分的销售业务。
请注意,我们需要下图所示图表,**

不分享代码的道歉。(尝试解决方案链接:https://dojo.telerik.com/igUmaqOw/3在这里,我已经尝试与剑道,但我想做在jquery)

irlmq6kh

irlmq6kh1#

嗨,伙计,在这里我创建了图表与kendoChart,希望你会喜欢它.

在这里的片段,我们需要许可证,但你可以使用下面的链接,剑道编辑器:https://dojo.telerik.com/AkUrAnon/3
图表

<!DOCTYPE html>
<html>
<head>
   
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2022.3.913/styles/kendo.default-ocean-blue.min.css" />

    <script src="https://kendo.cdn.telerik.com/2022.3.913/js/jquery.min.js"></script>
    
    
    <script src="https://kendo.cdn.telerik.com/2022.3.913/js/kendo.all.min.js"></script>
    
    

</head>
<body>
    <div id="example">
    <div class="demo-section wide">
        <div id="chart"></div>
    </div>
    <script>
        function createChart() {
            $("#chart").kendoChart({
                title: {
                    text: "Practice Versoon"
                },
                legend: {
                    visible: false
                },
                seriesDefaults: {
                    type: "column"
                },
                series: [{
                    name: "Auto",
                    stack: "2021",
                    data: [1, 32, 34, 36, 45, 33, 34, 83, 36, 37, 44, 37, 35, 36, 46],
                }, {
                    name: "Silver Medals",
                    stack: "2021",
                    data: [19, 25, 21, 26, 28, 31, 35, 60, 31, 34, 32, 24, 40, 38, 29],
                },{
                    name: "Auto",
                    stack: "2021",
                    data: [10, 32, 34, 36, 45, 33, 34, 83, 36, 37, 44, 37, 35, 36, 46],
                },
                 {
                    name: "Auto",
                    stack: "2020",
                    data: [1, 32, 34, 36, 45, 33, 34, 83, 36, 37, 44, 37, 35, 36, 46],
                }, {
                    name: "Silver Medals",
                    stack: "2020",
                    data: [19, 25, 21, 26, 28, 31, 35, 60, 31, 34, 32, 24, 40, 38, 29],
                },{
                    name: "Gold Medals",
                    stack: "2020",
                    data: [10, 32, 34, 36, 45, 33, 34, 83, 36, 37, 44, 37, 35, 36, 46],
                }],
                valueAxis: {
                    line: {
                        visible: false
                    }
                    
                },
                categoryAxis: {
                    categories: [1952, 1956, 1960, 1964, 1968, 1972, 1976, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012],
                    majorGridLines: {
                        visible: false
                    }
                },
                tooltip: {
                    visible: true,
                    template: "#= series.name #: #= value #"
                }
            });
        }

        $(document).ready(createChart);
        $(document).bind("kendo:skinChange", createChart);
    </script>
</div>


</body>
</html>

相关问题