All Components

Range Bar Charts / Basic usage

HTML5/JavaScript 源码

<!DOCTYPE html>
<html>
 <head> 
  <title>Basic usage</title> 
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <script>
        
    </script> 
 </head> 
 <body> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example"> 
   <div class="demo-section k-content wide"> 
    <div id="chart"></div> 
   </div> 
   <script>
        function createChart() {
            $("#chart").kendoChart({
                title: {
                    text: "Average Weather Conditions"
                },
                series: [{
                    type: "rangeColumn",
                    data: [[5, 11], [5, 13], [7, 15], [10, 19], [13, 23], [17, 28],
                           [20, 30], [20, 30], [17, 26], [13, 22], [9, 16], [6, 13]]
                }],
                seriesDefaults: {
                    labels: {
                        visible: true,
                        from: {
                            template: "#=value.from# °C",
                        },
                        to: {
                            template: "#=value.to# °C",
                        }
                    }
                },
                categoryAxis: {
                    categories: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
                    labels: {
                        rotation: "auto"
                    }
                },
                tooltip: {
                    visible: true,
                    template: "Avg Min Temp : #= value.from # °C <br>" +
                              "Avg Max Temp : #= value.to # °C"
                }
            });
        }

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