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

    1. <small id='W8xyb'></small><noframes id='W8xyb'>

      <i id='W8xyb'><tr id='W8xyb'><dt id='W8xyb'><q id='W8xyb'><span id='W8xyb'><b id='W8xyb'><form id='W8xyb'><ins id='W8xyb'></ins><ul id='W8xyb'></ul><sub id='W8xyb'></sub></form><legend id='W8xyb'></legend><bdo id='W8xyb'><pre id='W8xyb'><center id='W8xyb'></center></pre></bdo></b><th id='W8xyb'></th></span></q></dt></tr></i><div id='W8xyb'><tfoot id='W8xyb'></tfoot><dl id='W8xyb'><fieldset id='W8xyb'></fieldset></dl></div>
        <bdo id='W8xyb'></bdo><ul id='W8xyb'></ul>
        <tfoot id='W8xyb'></tfoot>
      1. Chart.js 折线图:在图的中间开始一条线

        时间:2023-11-01
          <tbody id='deTVr'></tbody>
      2. <legend id='deTVr'><style id='deTVr'><dir id='deTVr'><q id='deTVr'></q></dir></style></legend>

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

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

                <tfoot id='deTVr'></tfoot>
                  本文介绍了Chart.js 折线图:在图的中间开始一条线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想知道是否可以有多条线的图形,但我希望其中一条线从图形的中间开始,而其余的线仍然从左边开始.这可能吗?它看起来像这样:

                  I'm wondering if it is possible to have a graph with multiple lines, but I want one of the lines to start from the middle of the graph, while the rest of the lines still start from all the way at the left. Is this possible? It'd look like this:

                  绿线是我所说的,数据集是否有可能从不从左边开始

                  The green line is what I am talking about, whether it would be possible for a dataset to start from not all the way at the left

                  推荐答案

                  是的,这是可能的,你可以通过 2 种方式来实现,一种是使用其 x 和 y 坐标指定每个数据点,另一种是放置一些 null 数据数组开头的值:

                  Yes this is possible, you can achieve this in 2 ways, 1 is to specify each datapoint using its x and y coordinate another one is to place some null values in the start of your data array:

                  var options = {
                    type: 'line',
                    data: {
                      labels: [1, 2, 3, 4, 5, 6],
                      datasets: [{
                          label: '# of Votes',
                          data: [12, 19, 3, 5, 2, 3],
                          borderColor: 'pink'
                        },
                        {
                          label: '# of Points',
                          data: [{
                            x: 3,
                            y: 6
                          }, {
                            x: 4,
                            y: 8
                          }, {
                            x: 5,
                            y: 2
                          }, {
                            x: 6,
                            y: 12
                          }],
                          borderColor: 'orange'
                        },
                        {
                          label: '# of Points2',
                          data: [null, null, null, 9, 13, 15],
                          borderColor: 'lightblue'
                        }
                      ]
                    },
                    options: {
                      scales: {
                        yAxes: [{
                          ticks: {
                            reverse: false
                          }
                        }]
                      }
                    }
                  }
                  
                  var ctx = document.getElementById('chartJSContainer').getContext('2d');
                  new Chart(ctx, options);

                  <body>
                    <canvas id="chartJSContainer" width="600" height="400"></canvas>
                    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.5.0/chart.js"></script>
                  </body>

                  这篇关于Chart.js 折线图:在图的中间开始一条线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:CSS减轻父鼠标悬停的子元素 下一篇:Chart.js:如何更改任何尺寸的 x 轴刻度标签对齐方式?

                  相关文章

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

                  <tfoot id='9OXmI'></tfoot>

                      • <bdo id='9OXmI'></bdo><ul id='9OXmI'></ul>

                      <small id='9OXmI'></small><noframes id='9OXmI'>

                    1. <legend id='9OXmI'><style id='9OXmI'><dir id='9OXmI'><q id='9OXmI'></q></dir></style></legend>