问题标签 [chartjs-2.6.0]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
angular - ChartJs - 是否可以在一个数据集中仅显示工具提示?
我有两个数据集,一个是一条线,第二个是条形。
问题是工具提示在两个数据集中都有效,我只想在一个栏中工作。
我只想在条形数据集上显示工具提示,可以吗?
这是我的代码。
提前致谢。
javascript - 如何减少使用chartjs的组条形图中数据集的宽度
如何在使用 chartjs 的组条形图中减小数据集的宽度。在屏幕截图中,我用红线显示了需要减小的宽度。如果我们可以使用 chartjs 本身来做到这一点会更好,如果不是其他替代方案也欢迎。我指的是这个库http://www.chartjs.org/docs/latest/charts/bar.html
javascript - ChartJS unique datasets per label
I'm sitting here on a problem and I can't find a solution for it. I'm trying to create a stacked bar graph with chartJS. Nothing complicated to that point.
My problem: Every bar on my chart should have unique values / labels. Those shouldn't be repeated on the next bar... Kinda complicated to explain, thats why I draw a picture:
As you see, every bar should have its unique data. Normally, if you have "Apples" on the first bar with some value, "apples" will also apear on the second bar with some other values... But I don't want that. I really want separated bars, not related to each other in one graph.
Is there a way to achieve this?
I'm trying since like 48 hours and really tried everything. tried with multidimensional arrays, "stacked" options, multiple datasets but nothing seems to work. Is it even possible to achieve this with chartJS?
I'll post my current code (be aware that this is just one version of like 50 different things I tried... but I thought it may be good to post the simple code I have at the moment, since the other fails won't really help anything...)
Here's the code I'm currently trying to modify:
Really appreciate any help!
Thanks.
jquery - 在 ChartJS 中突出显示最后点击的栏
我正在尝试更改 ChartJS 中最后一个单击栏的不透明度,然后在下次单击另一个栏时将其“取消突出显示”。基本上是悬停的默认行为。请注意,这是一个堆叠条形图,我希望整个条形列的不透明度发生变化,而不是每个单独的部分。
我已经能够在单击时将背景颜色(不知道如何更改不透明度)更改为黑色,但在单击下一个项目时它不会取消设置。因此,一旦点击了所有内容,整个图表就会变成黑色。
这是我目前使用的 onclick 代码:
堆积数据:
任何帮助将不胜感激!
javascript - 始终显示 ChartJS 自定义工具提示
在此处和官方文档中遵循了几个指南之后,我完全被卡住了。
我有一些自定义工具提示,它们将根据自定义工具提示中的数据名称在其中显示 PNG 图形。
我找到了几种隐藏工具提示的解决方案,或者将它们全部设置为始终显示,但它们似乎都没有像我想要的那样工作。我希望隐藏标准工具提示,并始终显示我的自定义工具提示。
我的代码如下:
HTML:
CSS:
Javascript
有任何想法吗?它的工作原理是在悬停时显示图像,并且图像不会消失,直到您将鼠标悬停在甜甜圈的下一个切片上(而不是像通常那样立即消失)。我已经准备好用头撞砖墙了!
javascript - 使用图表js打印图表
我正在使用 Chart JS 库来创建图表https://www.chartjs.org/
说我有下面的代码
使用 FileSaver.js,我可以使用以下代码保存图表
但我不确定如何打印图表。看不到任何本机 API 调用来做到这一点。有人可以告诉我如何实现这一目标。
我尝试使用打印 HTMl 元素示例中提到的 jquery 打印库,但它们似乎没有加载使用 Chart js 生成的图表。我得到一个空白页进行打印。
谢谢
javascript - Chart.js:如果两者都存在,饼图图例“onclick”将被“options.onclick”覆盖
我有一个饼图,当您单击图表的一部分时需要调用一个函数,如果单击图例中的标签,则需要调用另一个不同的函数。我希望通过以下方式实现这种行为:
然而在实践中,只有第二个 onclick (调用graph_click( event);
)实际上会被执行。传说onClick
不起作用。我能做些什么来防止第二个 onClick 覆盖第一个?
javascript - 如何使chartjs中的饼图可点击(react-native)
我正在使用一个使 chartjs 在 react-native 上可用的库:
该图表运行良好,但当我按下饼图时,我只得到工具提示。我想要的是创建我自己的函数来加载一个弹出窗口而不是chart.js提供的工具提示你们会怎么做?它甚至可行吗?(我对 react-native 很陌生,如果这是一个愚蠢的问题,我很抱歉)。
图片: 图表
图表代码:
chart.js - 折线图绘制额外的 Y 值
我的值范围从 0 到 -6000...但是,chart.js 折线图绘制的 y 轴从 0 到 -25000...因此这些线条几乎相互重叠。如何防止 y 轴绘制那些多余的值,以便我的图表看起来更大。
配置如下: