jquery - Chart.js 圆环图工具提示大小?

标签 jquery tooltip chart.js

我想调整图表上工具提示的大小。 我使用了全局设置,但不起作用。我的图表上的工具提示太小。 Here is the view

$(document).ready(function () {
    // Chart options
    Chart.defaults.global.legend.display = false;
    Chart.defaults.global.titleFontSize = 20;
    var ctx = document.getElementById("Chart1");
    var myChart = new Chart(ctx, {
        type: 'doughnut',
        data: {
            labels: [
                "Produkty",
                ""
            ],
            datasets: [
            {
                data: <?=json_encode(array_values($values));?>,
                backgroundColor: [
                    "#2ecc71",
                    "#3498db"
                ],
                hoverBackgroundColor: [
                    "#27ae60",
                    "#2980b9"
                ]
            }]
        },
        options: {
            cutoutPercentage: 80
        }
    });
});

最佳答案

您也可以更改标题字体大小。

options: {
  tooltips: {
    titleFontSize: 10,
    bodyFontSize: 10
  }
}

关于jquery - Chart.js 圆环图工具提示大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41876614/

相关文章:

jquery - MVC 3,重用部分 View 和jquery,不与DOM冲突

jQuery显示数据索引大于或等于的所有容器

html - 我可以让 span 元素忽略列吗?

javascript - Bootstrap 3 工具提示高度

javascript - 使用动态注入(inject)的 jquery 追加 html 内容时抛出 TypeError :null is not an object (evaluating "$("body").append") 错误

jquery - 使用 :focus selector 检查子菜单的所有子菜单以查看 jquery 中是否有任何元素具有焦点

java - 如何取消工具提示的自动隐藏?

angular - 类型错误 : Cannot read property 'legend' of undefined | Angular + ng2-charts

mysql - 如何对图表进行分组

javascript - 如何使用chartJs中的折线图减小三 Angular 形的底部宽度?