<legend id='uLoQP'><style id='uLoQP'><dir id='uLoQP'><q id='uLoQP'></q></dir></style></legend>

<i id='uLoQP'><tr id='uLoQP'><dt id='uLoQP'><q id='uLoQP'><span id='uLoQP'><b id='uLoQP'><form id='uLoQP'><ins id='uLoQP'></ins><ul id='uLoQP'></ul><sub id='uLoQP'></sub></form><legend id='uLoQP'></legend><bdo id='uLoQP'><pre id='uLoQP'><center id='uLoQP'></center></pre></bdo></b><th id='uLoQP'></th></span></q></dt></tr></i><div id='uLoQP'><tfoot id='uLoQP'></tfoot><dl id='uLoQP'><fieldset id='uLoQP'></fieldset></dl></div>
  1. <small id='uLoQP'></small><noframes id='uLoQP'>

    <tfoot id='uLoQP'></tfoot>

      • <bdo id='uLoQP'></bdo><ul id='uLoQP'></ul>

    1. ChartJS – 有没有办法去除饼图周围的空白?

      ChartJS – is there any way to remove blank space around pie charts?(ChartJS – 有没有办法去除饼图周围的空白?)
      <tfoot id='CUX2l'></tfoot>

        <small id='CUX2l'></small><noframes id='CUX2l'>

        <i id='CUX2l'><tr id='CUX2l'><dt id='CUX2l'><q id='CUX2l'><span id='CUX2l'><b id='CUX2l'><form id='CUX2l'><ins id='CUX2l'></ins><ul id='CUX2l'></ul><sub id='CUX2l'></sub></form><legend id='CUX2l'></legend><bdo id='CUX2l'><pre id='CUX2l'><center id='CUX2l'></center></pre></bdo></b><th id='CUX2l'></th></span></q></dt></tr></i><div id='CUX2l'><tfoot id='CUX2l'></tfoot><dl id='CUX2l'><fieldset id='CUX2l'></fieldset></dl></div>
            <bdo id='CUX2l'></bdo><ul id='CUX2l'></ul>

              <legend id='CUX2l'><style id='CUX2l'><dir id='CUX2l'><q id='CUX2l'></q></dir></style></legend>
                <tbody id='CUX2l'></tbody>
              • 本文介绍了ChartJS – 有没有办法去除饼图周围的空白?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在处理一个在左侧和右侧有多余间距的图表.我一直在尝试删除它,但没有运气,我不知道现在还能做什么.我已经彻底阅读了文档,但似乎找不到解决方案.这可能吗?如果需要更多信息,请告诉我,我会提供.

                <canvas id="chart-gender"></canvas></div><脚本>var 性别数据 = [10, 35];var graph_gender_preset = {标签:[女性",男性"],数据集:[{数据:性别数据,背景颜色:[#0fa0e3",#ff3549"]}]};var ctx3 = $("#chart-gender");var chart_gender = new Chart(ctx3, {类型:'甜甜圈',数据:graph_gender_preset,选项: {响应式:真实,标题: {显示:假,位置:顶部",字体样式:粗体",字体大小:0,全宽:假,填充:0},传奇: {显示:假,位置:顶部",全宽:假,标签:{显示:假,usePointStyle:真,字体大小:15,字体样式:粗体"}}}});</脚本>

                解决方案

                问题不在于甜甜圈,而在于使用它的画布.

                甜甜圈必须使用二次方盒,否则它看起来像一个省略号.因此,如果您更改画布的大小并使其成为二次方,您将不再有任何边框.

                这是一个 JS Fiddle 示例.

                I am dealing with a chart that has unwanted spacing on left and right side. I've been trying to remove it with no luck, and I don't know what else to do now. I've read the documentation thoroughly, but can't seem to find a solution. Is this possible to do? Let me know if more info is necessary, and I'll supply it.

                Edit:

                <div>
                <canvas id="chart-gender"></canvas>  
                </div>
                
                
                <script>
                var gender_data = [10, 35];
                
                var graph_gender_preset = {
                    labels: ["Female", "Male"],
                    datasets: [
                        {
                            data: gender_data,
                            backgroundColor: ["#0fa0e3", "#ff3549"]
                        }
                    ]
                };
                
                var ctx3 = $("#chart-gender");
                
                var chart_gender = new Chart(ctx3, {
                type: 'doughnut',
                data: graph_gender_preset,
                options: {
                        responsive: true,
                        title: {
                            display: false,
                            position: "top",
                            fontStyle: "bold",
                            fontSize: 0,
                            fullWidth: false,
                            padding: 0
                        },
                        legend: {
                            display: false,
                            position: "top",
                            fullWidth: false,
                            labels: { display: false, usePointStyle: true, fontSize: 15, fontStyle: "bold" }
                
                        }
                    }
                });
                </script>
                

                解决方案

                The problem is not the doughnut, it is the canvas in which it is used.

                The doughnut has to use a quadratic box, otherwise it would look like an ellipsis. So if you change the size of the canvas and make it quadratic you won't have any borders anymore.

                Here is an JS Fiddle example.

                <table border="1">
                  <tr>
                    <td>
                      First
                    </td>
                    <td>
                      <canvas width="100%" height="100%" id="myChart"></canvas>
                    </td>
                    <td>
                      Third
                    </td>
                  </tr>
                </table>
                

                这篇关于ChartJS – 有没有办法去除饼图周围的空白?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                ChartJS Version 3 - common legend for multiple line charts(ChartJS 版本 3 - 多个折线图的常用图例)
                Charts.js scales yaxes ticks min max doesnt work(Charts.js 缩放 yaxes 刻度 min max 不起作用)
                How to expand the slice of donut chart in chartjs?(如何在chartjs中扩展圆环图的切片?)
                Chart.js yAxes Ticks stepSize not working (fiddle)(Chart.js yAxes Ticks stepSize 不起作用(小提琴))
                Rounded corners on chartJS v.2 - bar charts (with negative values)(chartJS v.2 上的圆角 - 条形图(带负值))
                How to hide value in Chart JS bar(如何在 Chart JS 栏中隐藏值)

                  <bdo id='jfUFq'></bdo><ul id='jfUFq'></ul>
                    <tbody id='jfUFq'></tbody>
                  • <small id='jfUFq'></small><noframes id='jfUFq'>

                        <legend id='jfUFq'><style id='jfUFq'><dir id='jfUFq'><q id='jfUFq'></q></dir></style></legend>

                        <i id='jfUFq'><tr id='jfUFq'><dt id='jfUFq'><q id='jfUFq'><span id='jfUFq'><b id='jfUFq'><form id='jfUFq'><ins id='jfUFq'></ins><ul id='jfUFq'></ul><sub id='jfUFq'></sub></form><legend id='jfUFq'></legend><bdo id='jfUFq'><pre id='jfUFq'><center id='jfUFq'></center></pre></bdo></b><th id='jfUFq'></th></span></q></dt></tr></i><div id='jfUFq'><tfoot id='jfUFq'></tfoot><dl id='jfUFq'><fieldset id='jfUFq'></fieldset></dl></div>
                        1. <tfoot id='jfUFq'></tfoot>