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

  • <small id='LwwGr'></small><noframes id='LwwGr'>

  • <tfoot id='LwwGr'></tfoot>
      <bdo id='LwwGr'></bdo><ul id='LwwGr'></ul>
  • <legend id='LwwGr'><style id='LwwGr'><dir id='LwwGr'><q id='LwwGr'></q></dir></style></legend>

        使用chartJS显示带有连接点的折线图

        时间:2023-11-01

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

              <tbody id='AJE7S'></tbody>

            <tfoot id='AJE7S'></tfoot>
            <legend id='AJE7S'><style id='AJE7S'><dir id='AJE7S'><q id='AJE7S'></q></dir></style></legend>

              <i id='AJE7S'><tr id='AJE7S'><dt id='AJE7S'><q id='AJE7S'><span id='AJE7S'><b id='AJE7S'><form id='AJE7S'><ins id='AJE7S'></ins><ul id='AJE7S'></ul><sub id='AJE7S'></sub></form><legend id='AJE7S'></legend><bdo id='AJE7S'><pre id='AJE7S'><center id='AJE7S'></center></pre></bdo></b><th id='AJE7S'></th></span></q></dt></tr></i><div id='AJE7S'><tfoot id='AJE7S'></tfoot><dl id='AJE7S'><fieldset id='AJE7S'></fieldset></dl></div>
                • <bdo id='AJE7S'></bdo><ul id='AJE7S'></ul>
                • 本文介绍了使用chartJS显示带有连接点的折线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想使用 ChartJS 绘制这样的图表.但是我找不到连接第一个和最后一个点并在该连接区域内显示单个唯一点的解决方案.而且我还需要为每个点设置不同颜色的样式.我尝试探索 ChartJS 文档,但找不到解决方案.是否有任何具有这些功能的图表绘图库或如何使用 ChartJS 做到这一点?

                  I want to draw a chart like this using ChartJS. But I couldn't find a solution for connect first and last dots and show single unique dot inside that connected area. And also I need to style each dot with different colors. I tried exploring ChartJS documentation but couldn't find a solution. Is there any chart drawing library which has these features or how to do this with ChartJS?

                  推荐答案

                  你可以创建一个散点图 而不是 线一个>.

                  You can create a scatter chart instead of line.

                  这是一个示例:
                  (试图复制您给定的图像amap)

                  var chart = new Chart(ctx, {
                     type: 'scatter',
                     data: {
                        datasets: [{
                           data: [{
                              x: 1,
                              y: 1
                           }, {
                              x: 3,
                              y: 7
                           }, {
                              x: 6,
                              y: 5
                           }, { // add same data as the first one, to draw the closing line
                              x: 1,
                              y: 1
                           }],
                           borderColor: 'black',
                           borderWidth: 1,
                           pointBackgroundColor: ['#000', '#00bcd6', '#d300d6'],
                           pointBorderColor: ['#000', '#00bcd6', '#d300d6'],
                           pointRadius: 5,
                           pointHoverRadius: 5,
                           fill: false,
                           tension: 0,
                           showLine: true
                        }, {
                           data: [{
                              x: 3.5,
                              y: 4.5
                           }],
                           pointBackgroundColor: 'orange',
                           pointBorderColor: 'darkorange',
                           pointRadius: 10,
                           pointHoverRadius: 10
                        }]
                     },
                     options: {
                        legend: false,
                        tooltips: false,
                        scales: {
                           xAxes: [{
                              ticks: {
                                 min: 0,
                                 max: 10
                              },
                              gridLines: {
                                 color: '#888',
                                 drawOnChartArea: false
                              }
                           }],
                           yAxes: [{
                              ticks: {
                                 min: 0,
                                 max: 8,
                                 padding: 10
                              },
                              gridLines: {
                                 color: '#888',
                                 drawOnChartArea: false
                              }
                           }]
                        }
                     }
                  });

                  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.min.js"></script>
                  <canvas id="ctx"></canvas>

                  注意:这只是一个示例,您可以按照 官方文档.

                  note : this is just an example, and you can customize it further to fit your need, following the official documentation.

                  这篇关于使用chartJS显示带有连接点的折线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Chart.js 轴标签字体大小 下一篇:Chart.js 2.0 使用货币和千位分隔符格式化 Y 轴

                  相关文章

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

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

                  1. <tfoot id='cDdby'></tfoot>

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