Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/418.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Chart.js工具提示不显示_Javascript_Asp.net_Charts - Fatal编程技术网

Javascript Chart.js工具提示不显示

Javascript Chart.js工具提示不显示,javascript,asp.net,charts,Javascript,Asp.net,Charts,图表工作精细但无法查看工具提示… 我找不到问题所在,也找不到我遗漏的东西 <div style="width: 1000px; height: 600"> <canvas id="myChart" ></canvas> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script> <sc

图表工作精细但无法查看工具提示… 我找不到问题所在,也找不到我遗漏的东西

<div style="width: 1000px; height: 600">
<canvas id="myChart" ></canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<script>
    var ctx = document.getElementById("myChart").getContext('2d');
    var myNewChart = new Chart(ctx, {
        type: 'line',
        data: {
            labels: ["24.5.2018. 15:23:48", "24.5.2018. 16:00:00", "24.5.2018. 17:00:00", ],
            datasets: [{
                label: '# Temperature',
                fill: false,
                data: [29, 25, 24,  ],
                backgroundColor: [
                               ],
                borderColor: [
                               ],
                borderWidth: 1
            }, {
                label: '# Humidity',
                data: [54, 62, 64,  ],
                borderColor: [
          ],
                borderWidth: 1,
                fill: false,
                type: 'line'
            }
        ]
        },
    options: {
    legend: {
      display: true,
      position: 'top',
      labels: {
        boxWidth: 80,
        fontColor: 'rgb(60, 180, 100)'
      }
    },
    tooltips: {
      cornerRadius: 4,
      caretSize: 4,
      xPadding: 16,
      yPadding: 10,
      backgroundColor: 'rgba(0, 150, 100, 0.9)',
      titleFontStyle: 'normal',
      titleMarginBottom: 15
    }
  }
    });
</script>

var ctx=document.getElementById(“myChart”).getContext(“2d”);
var myNewChart=新图表(ctx{
键入:“行”,
数据:{
标签:[“2018年5月24日15:23:48”、“2018年5月24日16:00:00”、“2018年5月24日17:00:00”,
数据集:[{
标签:“#温度”,
填充:假,
数据:[29、25、24、],
背景颜色:[
],
边框颜色:[
],
边框宽度:1
}, {
标签:“#湿度”,
数据:[54、62、64、],
边框颜色:[
],
边框宽度:1,
填充:假,
类型:“行”
}
]
},
选项:{
图例:{
显示:对,
位置:'顶部',
标签:{
箱宽:80,
fontColor:'rgb(60180100)'
}
},
工具提示:{
转弯半径:4,
caretSize:4,
加上:16,
加上:10,
背景颜色:“rgba(0,150100,0.9)”,
titleFontStyle:“正常”,
标题:15
}
}
});
帮助者种子,我需要添加更多的文字张贴这一点,但不知道如何简单的问题使更长…。我需要添加更多的文字来发布这个问题,但不知道简单的问题会变得多长……

试试看


var ctx=document.getElementById(“myChart”).getContext(“2d”);
var myNewChart=新图表(ctx{
键入:“行”,
数据:{
标签:[“2018年5月24日15:23:48”、“2018年5月24日16:00:00”、“2018年5月24日17:00:00”,
数据集:[{
标签:“#温度”,
填充:假,
数据:[29、25、24、],
边框宽度:1
}, {
标签:“#湿度”,
数据:[54、62、64、],
边框宽度:1,
填充:假,
类型:“行”
}]
},
选项:{
图例:{
显示:对,
位置:'顶部',
标签:{
箱宽:80,
fontColor:'rgb(60180100)'
}
},
工具提示:{
转弯半径:4,
caretSize:4,
加上:16,
加上:10,
背景颜色:“rgba(0,150100,0.9)”,
titleFontStyle:“正常”,
标题:15
}
}
});

只需从两个数据集中删除
backgroundColor:[]
borderColor:[]

只需尝试将其用作类似字符串的borderColor:'rgba(255,99132,1)'这很有用,但我发现代码有点迟钝。我稍微修改了它(并对其进行了修改,使其与访问属性的JS约定而不是python约定相匹配……),并添加了变量名和注释,使其更易于理解,但除此之外,它是一个直接派生:
<div style="width: 1000px; height: 600">
  <canvas id="myChart"></canvas>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<script>
  var ctx = document.getElementById("myChart").getContext('2d');
  var myNewChart = new Chart(ctx, {
    type: 'line',
    data: {
      labels: ["24.5.2018. 15:23:48", "24.5.2018. 16:00:00", "24.5.2018. 17:00:00", ],
      datasets: [{
        label: '# Temperature',
        fill: false,
        data: [29, 25, 24, ],
        borderWidth: 1
      }, {
        label: '# Humidity',
        data: [54, 62, 64, ],
        borderWidth: 1,
        fill: false,
        type: 'line'
      }]
    },
    options: {
      legend: {
        display: true,
        position: 'top',
        labels: {
          boxWidth: 80,
          fontColor: 'rgb(60, 180, 100)'
        }
      },
      tooltips: {
        cornerRadius: 4,
        caretSize: 4,
        xPadding: 16,
        yPadding: 10,
        backgroundColor: 'rgba(0, 150, 100, 0.9)',
        titleFontStyle: 'normal',
        titleMarginBottom: 15
      }
    }
  });

</script>