chart.js2

Event on Chart.JS's Bar Chart's mousein and mouseout?

两盒软妹~` 提交于 2021-02-08 07:47:32
问题 I've scoured the bar chart and event docs (which I find a bit confusing) and I've been unable to figure out how to act on a mousein and mouseout event when hovering over a Bar chart's bars (not the legend!). Currently the closest I've been able to come is utilizing the callback on the tooltip like so: options.tooltips = { backgroundColor: 'rgba(0,0,0,0)', fontColor: 'rgba(0,0,0,0)', callbacks: { label: function (tooltipItem) { // flipping a bool here } } }; This solution doesn't work well

Event on Chart.JS's Bar Chart's mousein and mouseout?

只谈情不闲聊 提交于 2021-02-08 07:45:26
问题 I've scoured the bar chart and event docs (which I find a bit confusing) and I've been unable to figure out how to act on a mousein and mouseout event when hovering over a Bar chart's bars (not the legend!). Currently the closest I've been able to come is utilizing the callback on the tooltip like so: options.tooltips = { backgroundColor: 'rgba(0,0,0,0)', fontColor: 'rgba(0,0,0,0)', callbacks: { label: function (tooltipItem) { // flipping a bool here } } }; This solution doesn't work well

Point Style property with Inverted Image in Line Chart.js

北慕城南 提交于 2021-02-08 07:02:52
问题 Refer the fiddle URL : https://jsfiddle.net/vL0ta76w/ Current Behaviour Point Style Property in Chart.js provides certain icons like a circle, triangle, rect, etc. to be displayed on the line chart var options = { type: 'line', data: { labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"], datasets: [ { label: '# of Votes', data: [12, -19, 3, 5, 2, 3], borderWidth: 1, pointStyle:'triangle', pointRadius:'10', pointBackgroundColor:'red' }, ], pointStyle:'triangle' }, options: { scales:

How to customize the tooltip of a Chart.js 2.0 Doughnut Chart?

醉酒当歌 提交于 2021-01-20 14:44:32
问题 I'm trying to show some data using a doughnut chart from Chart.js2. My current chart looks like this: My desired output must show another attribute, which is the percentage, and looks like this: I've read the documentation, but I can't cope with this because it's very general and I'm new to JavaScript. My code for the first chart is the following: const renderCashCurrencyPie = (cashAnalysisBalances) => { if (cashAnalysisBalances) { const currenciesName = cashAnalysisBalances .map(curName =>

How to customize the tooltip of a Chart.js 2.0 Doughnut Chart?

青春壹個敷衍的年華 提交于 2021-01-20 14:44:29
问题 I'm trying to show some data using a doughnut chart from Chart.js2. My current chart looks like this: My desired output must show another attribute, which is the percentage, and looks like this: I've read the documentation, but I can't cope with this because it's very general and I'm new to JavaScript. My code for the first chart is the following: const renderCashCurrencyPie = (cashAnalysisBalances) => { if (cashAnalysisBalances) { const currenciesName = cashAnalysisBalances .map(curName =>

Chart JS Zoom Pan

被刻印的时光 ゝ 提交于 2020-08-09 17:24:28
问题 I am using the Chart JS Zoom/Pan Plugin (https://github.com/chartjs/chartjs-plugin-zoom) and was wondering if there is a way to disable it when there is no data present. The current basic options settings are pan: { enabled: true, mode: 'x' }, zoom: { enabled: true, mode: 'x' } 回答1: Yes, you can change this by setting "enabled" to false and/or use chart.resetZoom() link 回答2: Try this: // since myChart.update() is not working. You need to do this. var myChartOptions = myChart.options; // need

chart.js plugin for making waterfall charts

女生的网名这么多〃 提交于 2020-05-23 21:07:56
问题 I want to create a chart.js plugin to create waterfall charts. I am new to working with chart.js. I was thinking to extend the bar-chart to create a waterfall chart. The draw function in the bar chart controller is as follows: draw: function(ease) { var me = this; var easingDecimal = ease || 1; helpers.each(me.getMeta().data, function(rectangle, index) { var d = me.getDataset().data[index]; if (d !== null && d !== undefined && !isNaN(d)) { rectangle.transition(easingDecimal).draw(); } }, me);

chart.js plugin for making waterfall charts

依然范特西╮ 提交于 2020-05-23 21:07:45
问题 I want to create a chart.js plugin to create waterfall charts. I am new to working with chart.js. I was thinking to extend the bar-chart to create a waterfall chart. The draw function in the bar chart controller is as follows: draw: function(ease) { var me = this; var easingDecimal = ease || 1; helpers.each(me.getMeta().data, function(rectangle, index) { var d = me.getDataset().data[index]; if (d !== null && d !== undefined && !isNaN(d)) { rectangle.transition(easingDecimal).draw(); } }, me);

Chart.js stacked bar chart - sorting values in bar by value

ε祈祈猫儿з 提交于 2020-05-23 07:44:31
问题 I try to implement a stacked bar chart using Chart.js framework (version 2.7) und faced following problem: single data elements are drawn in each bar in the same order as provided in JSON structure (which is absolutely logical and understandable). I would like to have them sorted: biggest elements at the bottom of the bar, smallest at its top. I suppose it can be accomplished using some plugin customization black magic but can not figure it out. Any help would be appreciated. Example: var