• <legend id='o8sGB'><style id='o8sGB'><dir id='o8sGB'><q id='o8sGB'></q></dir></style></legend>

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

  • <tfoot id='o8sGB'></tfoot>
      <bdo id='o8sGB'></bdo><ul id='o8sGB'></ul>

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

      1. Chart.js PolarArea 图表.将标签更改为 45 度角

        Chart.js PolarArea Chart. Changing the labels to a 45 degree angle(Chart.js PolarArea 图表.将标签更改为 45 度角)
        1. <small id='3QlyF'></small><noframes id='3QlyF'>

            <tbody id='3QlyF'></tbody>
          <legend id='3QlyF'><style id='3QlyF'><dir id='3QlyF'><q id='3QlyF'></q></dir></style></legend>
            <i id='3QlyF'><tr id='3QlyF'><dt id='3QlyF'><q id='3QlyF'><span id='3QlyF'><b id='3QlyF'><form id='3QlyF'><ins id='3QlyF'></ins><ul id='3QlyF'></ul><sub id='3QlyF'></sub></form><legend id='3QlyF'></legend><bdo id='3QlyF'><pre id='3QlyF'><center id='3QlyF'></center></pre></bdo></b><th id='3QlyF'></th></span></q></dt></tr></i><div id='3QlyF'><tfoot id='3QlyF'></tfoot><dl id='3QlyF'><fieldset id='3QlyF'></fieldset></dl></div>
            • <bdo id='3QlyF'></bdo><ul id='3QlyF'></ul>

                • <tfoot id='3QlyF'></tfoot>

                  本文介绍了Chart.js PolarArea 图表.将标签更改为 45 度角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在网上搜索了如何解决这个问题没有成功.我见过人们使用背景图片,但这似乎很懒惰且无益.我想将标签移动到 45 度角,这样看起来更专业.

                  I have searched through the net with no success on how to solve this. I have seen people use a background image but that seems lazy and unhelpful. I want to move the labels to a 45 degree angle so it looks more professional.

                  我的图表目前看起来像这样 -

                  My chart currently looks like this -

                  但我希望它看起来像这样 -

                  But I am wanting it to look like this -

                  有人对我如何做到这一点有任何想法吗?

                  Anyone have any ideas on how I can do this?

                  我的代码副本在下面.

                      new Chart(DummyChart, {
                        type: "polarArea",
                        data: {
                          labels: ["Dummy1", "Dummy 2", "Dummy 3", "Dummy 4"],
                          datasets: [
                            {
                              data: [125, 375, 300, 240],
                              backgroundColor: "#57C5C8",
                              borderWidth: 4,
                              hoverBorderColor: "white",
                              label: "Dummy Dummy "
                            }
                          ]
                        },
                        options: {
                          cutoutPercentage: 20,
                          legend: {
                            display: false
                          },
                          layout: {
                            padding: 0
                          },
                          scale: {
                            ticks: {
                              max: 450,
                              maxTicksLimit: 1,
                              display: false
                            },
                            angleLines: {
                              display: true
                            },
                            pointLabels: {
                              display: true
                            }
                          },
                          plugins: {
                            datalabels: {
                              display: false
                            }
                          }
                        }
                      });
                  
                  

                  推荐答案

                  这是我使用 datalables 插件的解决方案.

                  Here's my solution with the datalables plugin.

                  https://jsbin.com/bigedugasi/1/edit?html,js,输出

                  我已经更新了我以前的解决方案以使图表具有响应性.

                  I have updated my previous solutions to make the chart responsive.

                      plugins: {
                        datalabels: {
                          formatter: function(value, context) {
                            return context.chart.data.labels[context.dataIndex];
                          },
                          anchor: 'start',
                          align: 'end',
                          offset: 0 // Gets updated
                        }
                      },
                      onResize: function() {
                        let width = document.getElementById("pie-chart").width
                        let padding = myChart.options.layout.padding
                        myChart.options.plugins.datalabels.offset = width/2-padding
                      }
                  

                  这篇关于Chart.js PolarArea 图表.将标签更改为 45 度角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 栏中隐藏值)

                    <tbody id='oe5RY'></tbody>
                    • <bdo id='oe5RY'></bdo><ul id='oe5RY'></ul>

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

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