charts - 图表js : how can I align the legend and the title

标签 charts chart.js

enter image description here

我想将订单左对齐,图例居中。
我试过做

title:{
      display:true,
      fontSize:18,
      text: "Products",
      titleAlign:'left'
    }

但是 textalign似乎对我和 horizontal 都不起作用

最佳答案

检查 Chart.js 文档,没有像 titleAlign 这样的选项,请参阅:https://www.chartjs.org/docs/latest/configuration/title.html .
应该是在 future ,有一个请求请求:
https://github.com/chartjs/Chart.js/pull/5866 .

有一个选项可以做到这一点,您不应该显示图表标题并添加您自己的。
这是我如何做到的例子

<div class="panel panel-default">
    <div class="panel-heading">
        <h5>{{ title }}</h5>
    </div>
    <div class="panel-body">
         <canvas id="my-chart" width="150" height="150"></canvas>
    </div>
</div>

关于charts - 图表js : how can I align the legend and the title,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54396656/

相关文章:

c# - 如何调整图表的大小超过屏幕分辨率?

javascript - 如何在多次ajax调用后在不同的模态窗口中显示图表?

javascript - 如何在 es6 中编写更好的代码以使用数组值格式化对象

excel - 连接图表系列名称框中的文本

c++ - Qt - 滚动图表的可见区域

javascript - 数据数量不同的谷歌图表 2 行

javascript - 无法弄清楚如何使用 Chart.js 跳过 x 轴上的第一个数据点和 X 轴上的标签跳过倒数第二个数据点

javascript - Chartjs - 自定义 y 轴范围

javascript - 获取 Chart.js 数据的 JSON 字符串时出现问题

chart.js - ng2-charts 访问基础图表对象