Acceptable Range Highlighting of Background in Chart.js 2.0

前端 未结 5 967
小鲜肉
小鲜肉 2020-12-30 07:13

I\'m working on building a simple line chart using Chart.js (the 2.0.2 beta) and I\'d like to highlight a particular range of the chart\'s background to highlight an \"accep

5条回答
  •  有刺的猬
    2020-12-30 07:58

    this code will be helpful

    var bgdata = {
    
            datasets: [
            {
            label: "Average Hourly Blood Glucose Reading", 
            fill: false,
    
           data: [
                {
                    "y": 213,
                    "x": 0,
                    "backgroundColor": "rgba(29, 9, 158,0.2)",
                "label":"12:00 AM"
    
                },
                {
                    "y": 199,
                    "x": 1,
                    "backgroundColor": "rgba(29, 9, 158,0.4)",
                "label":"1:00 AM"
    
                },
            {
                    "y": 208,
                    "x": 2,
                    "backgroundColor": "rgba(29, 9, 158,0.6)",
                "label":"2:00 AM"
    
                }
            ]
                }
            ]
         };
    

提交回复
热议问题