当前位置: 首页 > 知识库问答 >
问题:

Image-Chart ChartJs勾调不起作用?

怀齐智
2023-03-14

试图了解什么是不工作的图像图表在这个URL?

https://image-charts.com/chart.js/2.8.0?bkg=white&c={“type”:“line”,“data”:{“datasets”:[{“type”:“line”,“fill”:false,“backgroundcolor”:“rgba(255,24,1,1)”,“bordercolor”:“rgba(255,24,1,1)”,“pointradius”:0,“data”:[67.0,65.0,70.0,81.0,83.0,81.0,79.0,74.0,78.0,77.0],“label”:

JSON:

{"type":"line","data":{"datasets":[{"type":"line","fill":false,"data":[59.0,57.0,57.0,58.0,57.0,56.0,57.0,55.0,62.0,63.0,62.0,62.0,69.0,63.0,62.0,61.0,62.0,62.0,66.0,69.0,72.0,72.0,75.0,82.0,84.0,85.0,84.0,81.0,91.0,90.0,87.0,87.0,89.0,90.0,90.0,86.0,86.0,86.0,86.0,83.0,83.0,82.0,81.0,85.0,89.0,85.0,83.0,87.0,81.0,81.0,81.0,91.0,90.0,81.0,87.0,83.0,98.0,90.0,81.0,88.0,88.0,88.0,88.0,90.0,90.0,90.0,92.0,90.0,91.0,90.0,88.0,81.0,83.0,91.0,88.0,87.0,87.0,87.0,87.0,87.0,87.0,87.0,88.0,90.0,87.0,88.0,91.0,88.0,86.0,86.0,87.0,86.0,91.0,90.0,91.0,92.0,91.0,91.0,88.0,87.0,88.0,95.0,94.0,92.0,92.0,91.0,88.0,88.0,90.0,88.0,90.0,87.0,87.0,88.0,88.0,91.0,88.0,91.0,94.0,90.0,90.0,88.0,88.0,87.0,88.0,87.0,88.0,86.0,86.0,87.0,87.0,88.0,90.0,88.0,79.0,74.0,83.0,85.0,83.0,85.0,85.0,85.0,85.0,85.0,83.0,90.0,85.0,85.0,85.0,85.0,85.0,86.0,87.0,87.0,91.0,90.0,90.0,90.0,90.0,90.0,86.0,85.0,85.0,86.0,86.0,86.0,86.0,85.0,85.0,86.0,86.0,85.0,85.0,83.0,85.0,87.0,85.0,86.0,88.0,88.0,88.0,86.0,91.0,92.0,88.0,85.0,87.0,86.0,86.0,85.0,86.0,86.0,87.0,87.0,88.0,87.0,92.0,88.0,83.0,85.0,87.0,87.0,90.0,85.0,87.0,87.0,86.0,85.0,85.0,87.0,87.0,88.0,90.0,91.0,86.0,87.0,87.0,86.0,90.0,87.0,90.0,90.0,94.0,92.0,91.0,87.0,87.0,88.0,90.0,91.0,92.0,90.0,86.0,88.0,87.0,87.0,88.0,87.0,88.0,88.0,87.0,88.0,87.0,87.0,87.0,88.0,88.0,91.0,90.0,90.0,91.0,91.0,87.0,90.0,92.0,87.0,86.0,88.0,88.0,88.0,88.0,92.0,92.0,81.0,78.0,79.0,83.0,86.0,87.0,88.0,87.0,87.0,85.0,85.0,87.0,87.0,87.0,87.0,86.0,86.0,85.0,86.0,86.0,85.0,85.0,87.0,86.0,88.0,90.0,91.0,90.0,95.0,97.0,98.0,95.0,97.0,97.0,97.0,97.0,98.0,95.0,95.0,108.0,95.0,95.0,95.0,91.0,78.0,83.0,82.0,92.0,89.0,88.0,85.0,86.0,94.0,94.0,97.0,99.0,99.0,97.0,95.0,91.0,92.0,94.0,95.0,92.0,94.0,94.0,95.0,92.0,94.0,94.0,95.0,95.0,92.0,94.0,97.0,95.0,95.0,94.0,102.0,104.0,99.0,98.0,95.0,94.0,91.0,94.0,94.0,91.0,92.0,91.0,92.0,97.0,94.0,92.0,91.0,97.0,95.0,109.0,112.0,112.0,112.0,110.0,112.0,112.0,109.0,110.0,112.0,109.0,105.0,104.0,102.0,100.0,105.0,102.0,102.0,105.0,107.0,105.0,105.0,104.0,104.0,105.0,107.0,102.0,104.0,104.0,102.0,105.0,105.0,104.0,104.0,107.0,104.0,102.0,105.0,105.0,105.0,105.0,105.0,105.0,107.0,105.0,102.0,104.0,104.0,104.0,105.0,107.0,105.0,109.0,109.0,109.0,109.0,105.0,107.0,107.0,107.0,105.0,105.0,110.0,112.0,107.0,107.0,105.0,105.0,109.0,107.0,107.0,107.0,109.0,105.0,109.0,110.0,109.0,110.0,107.0,112.0,117.0,110.0,109.0,116.0,114.0,112.0,112.0,110.0,110.0,109.0,104.0,112.0,116.0,114.0,116.0,112.0,112.0,112.0,112.0,112.0,110.0,109.0,105.0,112.0,114.0,110.0,110.0,114.0,116.0,112.0,107.0,112.0,107.0,110.0,109.0,110.0,107.0,109.0,110.0,114.0,110.0,110.0,114.0,112.0,112.0,116.0,117.0,117.0,117.0,114.0,114.0,109.0,109.0,110.0,107.0,109.0,110.0,109.0,109.0,107.0,112.0,112.0,112.0,112.0,114.0,110.0,107.0,109.0,110.0,109.0,110.0,114.0,112.0,109.0,114.0,110.0,112.0,114.0,116.0,110.0,112.0,112.0,119.0,121.0,119.0,117.0,114.0,110.0,114.0,107.0,107.0,107.0,109.0,105.0,104.0,105.0,105.0,104.0,104.0,102.0,104.0,105.0,102.0,105.0,102.0,107.0,104.0,109.0,109.0,109.0,109.0,109.0,109.0,107.0,107.0,109.0,109.0,112.0,110.0,110.0,110.0,112.0,109.0,110.0,107.0,107.0,112.0,110.0,109.0,109.0,109.0,114.0,112.0,109.0,107.0,112.0,109.0,110.0,107.0,110.0,112.0,112.0,109.0,105.0,105.0,105.0,109.0,107.0,110.0,109.0,109.0,107.0,107.0,107.0,112.0,114.0,109.0,109.0,107.0,107.0,105.0,107.0,107.0,105.0,105.0,104.0,107.0,116.0,114.0,112.0,112.0,112.0,110.0,110.0,107.0,95.0,94.0,80.0,83.0,85.0,92.0,98.0,100.0,98.0,98.0,97.0,100.0,104.0,107.0,105.0,102.0,100.0,100.0,100.0,102.0,102.0,100.0,104.0,107.0,105.0,107.0,104.0,102.0,104.0,102.0,102.0,102.0,104.0,117.0,98.0,102.0,104.0,104.0,102.0,100.0,100.0,104.0,107.0,107.0,104.0,104.0,104.0,104.0,102.0,104.0,104.0,104.0,107.0,110.0,112.0,112.0,109.0,105.0,119.0,104.0,91.0,88.0,95.0,105.0,104.0,104.0,104.0,102.0,109.0,105.0,100.0,102.0,104.0,104.0,105.0,104.0,105.0,102.0,104.0,104.0,102.0,102.0,100.0,104.0,104.0,109.0,105.0,104.0,114.0,116.0,112.0,110.0,110.0,112.0,107.0,112.0,109.0,107.0,107.0,107.0,107.0,105.0,104.0,104.0,102.0,102.0,107.0,105.0,105.0,107.0,102.0,105.0,107.0,109.0,112.0,109.0,107.0,104.0,105.0,105.0,107.0,105.0,107.0,105.0,105.0,109.0,107.0,107.0,107.0,105.0,105.0,110.0,110.0,109.0,105.0,105.0,104.0,107.0,104.0,104.0,104.0,102.0,104.0,104.0,107.0,105.0,102.0,102.0,104.0,105.0,102.0,107.0,105.0,107.0,104.0,107.0,105.0,102.0,104.0,102.0,105.0,105.0,107.0,107.0,109.0,107.0,109.0,107.0,109.0,109.0,109.0,110.0,109.0,107.0,105.0,105.0,107.0,110.0,107.0,109.0,105.0,109.0,107.0,109.0,109.0,110.0,109.0,104.0,104.0,110.0,112.0,112.0,114.0,117.0,112.0,114.0,112.0,112.0,110.0,121.0,117.0,117.0,112.0,114.0,116.0,110.0,109.0,112.0,110.0,110.0,107.0,105.0,105.0,105.0,105.0,100.0,107.0,105.0,105.0,105.0,109.0,105.0,107.0,102.0,102.0,107.0,104.0,105.0,104.0,100.0,102.0,102.0,102.0,107.0,107.0,105.0,102.0,98.0,102.0,105.0,105.0,107.0,109.0,107.0,100.0,100.0,98.0,100.0,100.0,102.0,102.0,102.0,102.0,104.0,107.0,104.0,107.0,105.0,102.0,105.0,107.0,112.0,107.0,107.0,107.0,105.0,105.0,105.0,109.0,109.0,107.0,109.0,110.0,109.0,107.0,107.0,102.0,102.0,107.0,112.0,112.0,112.0,112.0,109.0,105.0,109.0,109.0,109.0,116.0,110.0,107.0,107.0,116.0,110.0,104.0,107.0,107.0,110.0,116.0,116.0,119.0,112.0,112.0,109.0,109.0,107.0,110.0,114.0,112.0,110.0,116.0,109.0,110.0,110.0,116.0,110.0,109.0,110.0,107.0,107.0,105.0,107.0,114.0,109.0,109.0,105.0,105.0,102.0,109.0,109.0,105.0,107.0,105.0,104.0,105.0,109.0,107.0,105.0,112.0,114.0,112.0,114.0,116.0,118.0,115.0,115.0,115.0,116.0,122.0,118.0,116.0,115.0,113.0,113.0,113.0,116.0,118.0,118.0,120.0,118.0,115.0,109.0,111.0,116.0,113.0,111.0,113.0,120.0,118.0,115.0,115.0,113.0,115.0,111.0,111.0,107.0,107.0,106.0,107.0,106.0,107.0,111.0,116.0,115.0,109.0,111.0,111.0,109.0,109.0,113.0,111.0,113.0,111.0,109.0,107.0,107.0,109.0,107.0,109.0,109.0,107.0,107.0,109.0,107.0,106.0,106.0,106.0,107.0,106.0,104.0,104.0,111.0,107.0,104.0,104.0,104.0,106.0,106.0,104.0,107.0,107.0,104.0,109.0,124.0,120.0,115.0,115.0,113.0,111.0,113.0,113.0,118.0,115.0,116.0,115.0,115.0,115.0,115.0,113.0,115.0,113.0,99.0,96.0,104.0,109.0,107.0,107.0,111.0,111.0,111.0,113.0,113.0,118.0,116.0,115.0,111.0,109.0,109.0,107.0,109.0,115.0,111.0,111.0,113.0,115.0,111.0,107.0,107.0,109.0,111.0,115.0,115.0,111.0,109.0,113.0,116.0,115.0,115.0,120.0,116.0,120.0,115.0,111.0,113.0,111.0,113.0,109.0,107.0,111.0,106.0,107.0,113.0,111.0,115.0,111.0,107.0,107.0,111.0,113.0,109.0,106.0,107.0,109.0,109.0,109.0,107.0,106.0,107.0,109.0,111.0,107.0,107.0,111.0,113.0,107.0,109.0,115.0,109.0,111.0,107.0,107.0,111.0,109.0,111.0,111.0,111.0,109.0,111.0,113.0,115.0,111.0,116.0,111.0,106.0,111.0,107.0,109.0,106.0,106.0,107.0,104.0,104.0,109.0,109.0,107.0,106.0,106.0,107.0,111.0,109.0,113.0,111.0,107.0,111.0,111.0,109.0,109.0,111.0,115.0,113.0,111.0,115.0,115.0,113.0,111.0,116.0,115.0,115.0,113.0,113.0,113.0,113.0,113.0,115.0,116.0,116.0,116.0,113.0,113.0,109.0,109.0,115.0,109.0,100.0,96.0,89.0,107.0,104.0,104.0,109.0,106.0,111.0,109.0,104.0,107.0,109.0,107.0,107.0,104.0,107.0,109.0,109.0,109.0,115.0,113.0,109.0,113.0,109.0,107.0,106.0,106.0,109.0,106.0,104.0,106.0,106.0,107.0,107.0,106.0,109.0,111.0,109.0,111.0,111.0,107.0,111.0,109.0,111.0,109.0,106.0,102.0,106.0,104.0,102.0,102.0,102.0,104.0,109.0,109.0,106.0,107.0,109.0,113.0,115.0,107.0,107.0,109.0,102.0,104.0,106.0,106.0,107.0,106.0,111.0,111.0,107.0,106.0,104.0,107.0,106.0,104.0,109.0,111.0,111.0,113.0,107.0,104.0,106.0,107.0,109.0,113.0,109.0,111.0,116.0,116.0,115.0,107.0,107.0,113.0,109.0,106.0,102.0,104.0,109.0,107.0,107.0,106.0,104.0,102.0,107.0,106.0,104.0,102.0,104.0,104.0,102.0,104.0,111.0,113.0,113.0,107.0,109.0,109.0,109.0,104.0,106.0,106.0,109.0,115.0,113.0,113.0,111.0,111.0,111.0,106.0,109.0,106.0,106.0,102.0,102.0,102.0,102.0,100.0,102.0,100.0,100.0,99.0,97.0,99.0,100.0,100.0,99.0,100.0,99.0,102.0,104.0,102.0,99.0,99.0,102.0,102.0,100.0,97.0,97.0,97.0,97.0,100.0,99.0,111.0,111.0,109.0,107.0,104.0,115.0,111.0,111.0,113.0,115.0,113.0,115.0,109.0,109.0,111.0,109.0,107.0,107.0,104.0,106.0,116.0,115.0,111.0,111.0,106.0,106.0,111.0,107.0,111.0,111.0,109.0,106.0,106.0,104.0,102.0,104.0,104.0,106.0,104.0,104.0,102.0,100.0,104.0,102.0,100.0,99.0,99.0,100.0,99.0,100.0,100.0,100.0,99.0,100.0,97.0,99.0,97.0,102.0,100.0,100.0,100.0,99.0,99.0,97.0,99.0,97.0,99.0,96.0,97.0,96.0,97.0,96.0,100.0,104.0,100.0,104.0,102.0,106.0,106.0,104.0,104.0,102.0,99.0,113.0,115.0,109.0,107.0,111.0,111.0,113.0,109.0,109.0,109.0,115.0,124.0,124.0,115.0,118.0,116.0,115.0,113.0,122.0,120.0,116.0,122.0,118.0,118.0,120.0,109.0,113.0,115.0,111.0,113.0,113.0,115.0,116.0,113.0,115.0,118.0,115.0,113.0,113.0,109.0,107.0,113.0,109.0,107.0,107.0,107.0,109.0,106.0,107.0,113.0,118.0,122.0,122.0,118.0,118.0,122.0,120.0,118.0,113.0,115.0,115.0,111.0,120.0,60.0,116.0,115.0,115.0,115.0,113.0,113.0,113.0,115.0,111.0,113.0,109.0,113.0,111.0,109.0,99.0,100.0,96.0,99.0,102.0,109.0,102.0,104.0,111.0,107.0,107.0,104.0,107.0,109.0,107.0,102.0,104.0,107.0,109.0,107.0,106.0,107.0,107.0,107.0,107.0,106.0,111.0,106.0,104.0,107.0,111.0,111.0,107.0,113.0,109.0,111.0,109.0,104.0,106.0,107.0,107.0,109.0,111.0,113.0,109.0,107.0,107.0,109.0,111.0,113.0,111.0,107.0,109.0,109.0,106.0,113.0,109.0,111.0,109.0,106.0,109.0,111.0,107.0,106.0,107.0,111.0,113.0,111.0,109.0,107.0,109.0,109.0,109.0,115.0,115.0,109.0,116.0,113.0,109.0,111.0,116.0,120.0,113.0,111.0,113.0,113.0,111.0,113.0,111.0,109.0,107.0,115.0,115.0,111.0,113.0,107.0,107.0,109.0,109.0,111.0,111.0,111.0,111.0,111.0,113.0,111.0,113.0,115.0,111.0,115.0,111.0,111.0,111.0,111.0,109.0,113.0,115.0,111.0,109.0,106.0,109.0,106.0,109.0,106.0,111.0,111.0,113.0,111.0,111.0,113.0,111.0,111.0,109.0,111.0,109.0,107.0,107.0,107.0,111.0,109.0,113.0,115.0,111.0,109.0,109.0,109.0,116.0,116.0,115.0,115.0,113.0,109.0,106.0,107.0,107.0,107.0,106.0,104.0,104.0,107.0,107.0,106.0,104.0,102.0,102.0,104.0,102.0,102.0,106.0,106.0,104.0,102.0,100.0,111.0,109.0,115.0,128.0,128.0,120.0,120.0,120.0,115.0,116.0,115.0,115.0,118.0,120.0,120.0,124.0,115.0,118.0,113.0,111.0,115.0,113.0,113.0,113.0,109.0,107.0,113.0,111.0,113.0,109.0,111.0,107.0,106.0,107.0,111.0,111.0,109.0,111.0,111.0,109.0,106.0,106.0,104.0,104.0,106.0,107.0,111.0,109.0,106.0,106.0,109.0,107.0,106.0,111.0,115.0,111.0,109.0,113.0,115.0,115.0,109.0,109.0,111.0,111.0,109.0,120.0,115.0,113.0,115.0,116.0,111.0,109.0,113.0,116.0,118.0,106.0,99.0,89.0,97.0,99.0,100.0,107.0,104.0],"label":"Output"}]},"options":{}}

共有3个答案

景唯
2023-03-14

Image-Charts创建于此,实际上出于安全和可靠性的原因,我们的Charts API目前不支持JavaScript函数。

ps:稍后我们可能会根据客户需求添加JavaScript函数支持:)

濮阳宜
2023-03-14

我不能告诉您为什么image-charts.com不接受您的请求,但从chart.js的角度来看,您的图表配置看起来几乎很好,包括ticks.callback。我能看到的唯一问题是data.labels包含的项数与data.datasets[0].data不相同。

X轴ticks.callback的推定问题是,返回的string值与空字符串组合在一起,这会产生与不使用ticks.callback相同的结果。

"ticks": {
   "callback": function(value, index, values) {
     return '' + value;
   }
 }

不确定您所期望的是什么,但请注意,X轴的刻度是那些出现在图表底部的刻度。

如果要格式化Y轴上的刻度标签,可以使用以下方法(请参阅https://stackoverflow.com/A/1726662/2358409):

"yAxes": [{
  "ticks": {
    "callback": value => value.toFixed(1)
  },
  ...

请看一下下面的可运行代码,看看它是如何工作的。

null

new Chart(document.getElementById('myChart'), {
  "type": "line",
  "data": {
    "datasets": [{
      "type": "line",
      "fill": false,
      "backgroundColor": "rgba(255, 24, 1, 1)",
      "borderColor": "rgba(255, 24, 1, 1)",
      "pointRadius": 0,
      "data": [67.0, 65.0, 70.0, 81.0, 83.0, 81.0, 79.0, 74.0, 78.0, 77.0],
      "label": "Output"
    }],
    "labels": ["00", "05", "10", "15", "20", "25", "30"]
  },
  "options": {
    "tooltips": {
      "intersect": false
    },
    "scales": {
      "xAxes": [{
        "gridLines": {
          "display": false
        }        
      }],
      "yAxes": [{
        "ticks": {
          "callback": value => value.toFixed(1)
        },
        "gridLines": {
          "display": false
        }
      }]
    }
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script>
<canvas id="myChart" height="100"></canvas>
爱海
2023-03-14

您得到的错误是它不是有效的JSON。

据我所知,JSON不支持函数,所以在将数据发送到Image-Chart之前,必须删除回调并确保刻度已经正确。

如果删除回调函数,它可以正常工作:https://image-charts.com/chart.js/2.8.0?bkg=white&c={%22Type%22:%22Line%22,%22Data%22:{%22Type%22:%22Line%22,%22Fill%22:false,%22BackgroundColor%22:%22RGBA(255,%2024,%201,%201)%22,%22BorderColor%22:%22RGBA(255,%2024,%201,%201)%22,%22PointRadius%22:0,%22Data%22:[67.0,65.0,70.0,81.0,83.0

如果您真的需要回调的功能,您将不得不实现库的普通版本,在这里,您的原始配置是按预期工作的。

 类似资料:
  • 注意:我正在手动转发测试时间。(如果这有什么不同的话)

  • 我在may Spring应用程序中添加了安全问题,所以我想通过调试Spring。 Log4j正在工作,因为我的服务正在将调试信息记录到控制台。但是Spring没有记录任何东西到我的控制台 这是我的 在我如此放置。结果: 我尝试在我的网站上添加这个。正如在这个问题中所说的xml 我在其他应用程序中使用了此调试,但我真的没有看到原因。。。谢谢你的帮助

  • 问题内容: 我有一个按钮,该按钮调用animateWithDuration代码,以淡出图像,淡入文本和in的新bg颜色,然后将其重置为正常值。动画需要几秒钟才能完成,效果很好。 然而! 有一个问题: 有时在动画结束之前会再次按下此按钮。发生这种情况时,我希望当前的动画停止并重新开始。 研究解决方案不起作用 根据我的阅读,解决方案应该很简单,只需导入QuartzCore并添加: 这确实删除了动画,但

  • 问题内容: 已编辑 我有一个ajax调用(使用),它调用以下php脚本。 这持续了40秒。 如果我关闭触发调用的浏览器窗口, 即使我显式发送了一个字符串并刷新了缓冲区 ,它仍然返回false ! 请问有人在这里回答吗? 问题答案: 您将需要添加“ ignore_user_abort(true);” 在PHP脚本之上,并在从脚本中回显某些内容后调用“ ob_flush()”(有关原因,请参见 PHP

  • 所以我试图写一个程序,循环通过三角形的三个边的所有可能的边长组合,并打印遵循勾股定理的那些(即,侧A(sqr)侧B(sqr)=斜边(sqr))。匹配的,它应该打印。然而,数学没有按照它应该的方式执行。我认为问题在于我如何设置我的循环。 那么我的问题是,我应该如何设置?因为我觉得for循环的执行方式如下: 最外层的循环将检查毕达哥拉斯条件是否满足。如果是,它将打印结果、递增并再次测试。当条件不满足时

  • 问题内容: 我制作了一个Jquery函数,该函数(目前)会动态调用该函数,并显示警告。与Firefox,铬:它的作品!当我尝试IE7(第一次)时,它失败了。如果我重新加载页面(F5)并重试,则可以!o_O 我终于明白为什么会这样。在我的旧网站中,我使用了jquery-1.3.2.min.js库。在此我使用jquery-1.4.2.js,实际上它不起作用。那么这是什么一回事?这个新版本中有错误吗?