如何使用与屏幕分辨率相对应的canvasjs.js设置动态fontsize

时间:2018-02-05 05:57:43

标签: javascript html5 css3 canvasjs

window.onload = function () {
    var chart = new CanvasJS.Chart("chartContainer",
    {
      title:{
        text: "Index Labels with Big Fonts",
        fontSize:15,
      },
      data: [
      {
       indexLabelFontSize: 26,
       type: "doughnut",
       dataPoints: [
       { y: 36, indexLabel:"36%" },
       { y: 17, indexLabel:"17%" },
       { y: 16, indexLabel:"16%" },
       { y: 9, indexLabel: "9%" },
       { y: 8, indexLabel:"8%" },
       { y: 7, indexLabel: "7%" },
       { y: 7, indexLabel: "7%" }

       ]
     }
     ]
   });

    chart.render();
  }
<script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
    <div id="chartContainer" style="height: 300px; width: 100%;">
    </div>

0 个答案:

没有答案