柱状图和折线图在使用 Chart JS 时不起作用。

huangapple go评论64阅读模式
英文:

Bar and line chart not working using chart JS

问题

我正在尝试制作一个包含许多图表的HTML报告。
每个图表都运行正常,除了一个名为“Surface Solar Radiation and Sunshine”的图表。
我已经尝试了一切来调试它并找出问题的原因,但无法解决它。

当我将不起作用的图表代码复制到一个单独的文件中并尝试运行它时,它可以正常工作,但一旦将其与其他图表放在一起,它就不起作用了。

代码太长了,所以这里是代码文档的链接:代码文档链接

正常工作的图表

柱状图和折线图在使用 Chart JS 时不起作用。

如您所见,“Surface Solar Radiation and Sunshine”图表没有显示,而其他图表可见。

英文:

I am trying the make a html report that contain a lot of charts in it.
every chart is working fine
except the one chart Surface Solar Radiation and Sunshine.
I have tried everything debug it and to find the reason of the problem but could not resolve it.

When I copied that not working chart code into a separate file and tried to run it, it worked perfectly fine, but as soon as i kept it with other chart again it; not working

code is too long, so here is link of the code doc

working chart

柱状图和折线图在使用 Chart JS 时不起作用。

As you can see that Surface Solar Radiation and Sunshine chart is not showing and other charts are visible

答案1

得分: 1

我已经看到了代码
你正在两次使用window.onload = function()
你应该将加载函数合并成一个图表然后使用它
它会起作用的

英文:

I have seen the code
you are using the window.onload = function() two time
you should combine the on load function in a one chart and then use it
it will work

huangapple
  • 本文由 发表于 2023年6月18日 23:40:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/76501320.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定