ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 图表 更多个性化定制请参考组件依赖组件 [http://www.chartjs.org](http://www.chartjs.org/docs/latest/getting-started/usage.html) ![](https://box.kancloud.cn/40ce7885771e3c0b3ffb101d78032a1e_500x267.png) ## 使用 ``` <div style="width: 500px;height: 100px;"> <canvas id="myChart"></canvas> </div> <script> require(['hdjs'], function (hdjs) { let options = { type: 'bar', data: { labels: ["hdjs", "hdphp", "hdcms", "Green", "Purple", "Orange"], datasets: [{ label: '# of Votes', data: [12, 19, 3, 5, 2, 3], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)', 'rgba(75, 192, 192, 0.2)', 'rgba(153, 102, 255, 0.2)', 'rgba(255, 159, 64, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)', 'rgba(75, 192, 192, 1)', 'rgba(153, 102, 255, 1)', 'rgba(255, 159, 64, 1)' ], borderWidth: 2 }] }, options: { title: { display: true, text: '后盾人 人人做后盾' }, scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }; hdjs.chart('#myChart',options); }) </script> ```