chart.js

Why does chart update fail when its container has ng-show on it?

点点圈 提交于 2020-02-08 07:41:13
问题 I have a compiled directive that contains an angular-charts.js directive in it. I've noticed that when the container of that chart has ng-show or ng-hide as an attribute, the chart wont update -- it just doesn't show at all. Here is a plunker that demonstrates this (see listeningComponent in scripts.js directive) 回答1: Here the problem is not with the ng-show and ng-hide attribute. The root cause behind this is is DOM manupulation. Here ng-show condition is executing first and directive is

Why does chart update fail when its container has ng-show on it?

梦想与她 提交于 2020-02-08 07:40:07
问题 I have a compiled directive that contains an angular-charts.js directive in it. I've noticed that when the container of that chart has ng-show or ng-hide as an attribute, the chart wont update -- it just doesn't show at all. Here is a plunker that demonstrates this (see listeningComponent in scripts.js directive) 回答1: Here the problem is not with the ng-show and ng-hide attribute. The root cause behind this is is DOM manupulation. Here ng-show condition is executing first and directive is

How do I implement the 'autoskip' feature in chartjs?

Deadly 提交于 2020-02-06 06:42:18
问题 Example I am trying to use the autoSkip feature found here in the chart.js documentation: https://www.chartjs.org/docs/latest/axes/cartesian/?h=autoskip The issue I am having is my x-axes labels are overlapping (see above example). Everything I have read says this autoSkip feature should automatically skip overlapping labels. However, when setting this to both true or false, nothing seems to change in my chart. <Line data={this.state.chartData} options={{ elements: { point: { radius: 2 } },

How do I implement the 'autoskip' feature in chartjs?

£可爱£侵袭症+ 提交于 2020-02-06 06:41:05
问题 Example I am trying to use the autoSkip feature found here in the chart.js documentation: https://www.chartjs.org/docs/latest/axes/cartesian/?h=autoskip The issue I am having is my x-axes labels are overlapping (see above example). Everything I have read says this autoSkip feature should automatically skip overlapping labels. However, when setting this to both true or false, nothing seems to change in my chart. <Line data={this.state.chartData} options={{ elements: { point: { radius: 2 } },

Chart.js show data in chronological order

大城市里の小女人 提交于 2020-02-05 00:12:05
问题 I have a chart using Chart.js but regardless of what order I put the input data it is outputted out of order, here is a fiddle: const response = [ { "mmyy":"12/19", "promocode":"promo1", "amount":"2776" }, { "mmyy":"01/20", "promocode":"promo1", "amount":"1245" }, { "mmyy":"01/20", "promocode":"promo2", "amount":"179" } ]; var chartColors = window.chartColors; var color = Chart.helpers.color; const colors = [color(chartColors.red).alpha(0.5).rgbString(), color(chartColors.orange).alpha(0.5)

Chart.js Ionic 2 Angular2: Background color of bar graph not changing

守給你的承諾、 提交于 2020-02-04 01:41:25
问题 I'm using Chart.js to create a stacked bar graph for a hybrid app using Ionic2 and Angular2. I cannot get the background color or fill color of the bars in the graph to change. I've used every configuration/example that is given on chart.js documentation, and I always get the default red and blue default(?) colors. Here is what I have: barChartOptions:any = { responsive: true, scales: { xAxes: [{ categoryPercentage: 0.6, barPercentage: 1.0, stacked: true, ticks: { beginAtZero: true },

How can i add an image as background in Chartjs?

北城以北 提交于 2020-02-03 22:02:55
问题 I am using chart.js lib on a programmable device i need to add an image as background to my chart, if that is not possible how can i change background color to black?. I cannot use Jquery as it is not supported by the Platform. Thank you 回答1: You can style the canvas element. Something like this will work canvas { background-color: black; } Fiddle - https://jsfiddle.net/w1yhp03h/ 回答2: Thank you! I didn't think to CSS, i added an image too in a similar way canvas { background-image: url

ChartJS: get points information on hovering the points

a 夏天 提交于 2020-02-03 04:38:05
问题 I have successfully got the information by onClick function. But is there any method i can get the point information on Hovering over the point. Right now onHover as mentioned in docs is not working to get the point. This is my jsFiddle. 回答1: In previous versions of Chart.js (for example 2.6) the onHover handler has to be configured as below: hover: { onHover: function(evt, item) { if (item.length) { console.log("onHover", item, evt.type); console.log(">data", item[0]._index, data.datasets[0]

Position tooltip in center of bar

本小妞迷上赌 提交于 2020-02-02 16:26:46
问题 Can't find a way to position tooltip in center of bar like this (yeah, I know it is not exactly in center on this screenshot, but still): If I use custom tooltip option, I can get only x and y positions of a caret on top of a bar. But can't get height/width of a bar. Here is a part of an options object that I pass to Chart constructor: const options = { tooltips: { enabled: false, custom: (tooltip) => { // Retrieving valuable props from tooltip (caretX, caretY) // and creating custom tooltip

Position tooltip in center of bar

↘锁芯ラ 提交于 2020-02-02 16:26:46
问题 Can't find a way to position tooltip in center of bar like this (yeah, I know it is not exactly in center on this screenshot, but still): If I use custom tooltip option, I can get only x and y positions of a caret on top of a bar. But can't get height/width of a bar. Here is a part of an options object that I pass to Chart constructor: const options = { tooltips: { enabled: false, custom: (tooltip) => { // Retrieving valuable props from tooltip (caretX, caretY) // and creating custom tooltip