chart.js

ChartJS: chart not show all data

匆匆过客 提交于 2021-01-29 03:18:14
问题 For some reason, this chart not show the last two data from the array. var data = { labels: ["Brasil", "Argentina", "Chile", "Paraguai", "Peru", "Bolívia", "México"], datasets: [{ data: [ 9.19, 7.77, 6.80, 6.23, 6.00, 4.00, 4.00 ], backgroundColor: backgroundColor }], }; http://codepen.io/marcelo2605/pen/PWWqJm?editors=0010 Anyone known why is this happens? 回答1: you need to set Y-Axis to start with 0, by default it start with the minimum value present in the data set which is 4 in your case.

ChartJS: Update tooltip

依然范特西╮ 提交于 2021-01-28 14:53:03
问题 I'm having a chart build with ChartJS. I'm including datasets.label in multipleTooltipLabel template and facing an update issue. When changing a datasets.label and running chart.update() the tooltip is not updated. I created a JSFiddle demonstrating the issue. The code I use to include datasets label in tooltip: var options = { multiTooltipTemplate: "<%=datasetLabel%>: <%= value + ' %' %>" }; Beside that option I followed ChartJS usage example for Line charts. Change label and update chart:

ChartJS: Update tooltip

寵の児 提交于 2021-01-28 14:33:59
问题 I'm having a chart build with ChartJS. I'm including datasets.label in multipleTooltipLabel template and facing an update issue. When changing a datasets.label and running chart.update() the tooltip is not updated. I created a JSFiddle demonstrating the issue. The code I use to include datasets label in tooltip: var options = { multiTooltipTemplate: "<%=datasetLabel%>: <%= value + ' %' %>" }; Beside that option I followed ChartJS usage example for Line charts. Change label and update chart:

Chart.js Customizing Tick Labels for Mixed Font Styles

。_饼干妹妹 提交于 2021-01-28 07:01:00
问题 I am building a chart with React and Chart.js, and I need to display tick labels that have mixed font styles. Chart.js returns the tick values as a string of the the text passed in as well as the HTML tags that wrap the values we want to italicize. I tried writing a callback function to return jsx which nulled out the y axis tick marks. Additionally, I have tried applying conditions to the fontStyle prop, and customizing the html in the labels. let italicizedFont = 'Font'.italics() console

ng2-chart tooltip position change option?

假装没事ソ 提交于 2021-01-28 06:40:23
问题 I am trying to build a Doughnut Chart using ng2-chart Angular2 directives for Chart.js. This chart.js has default option for tooltip positioning, I want to make tooltip to show outside the chart. Is there a way to make it possible? public doughnutChartOptions = { responsive: true, tooltips:{ mode: 'nearest', } } I expect something like tooltip to be displayed outside the chart, Instead of showing inside the chart; top, bottom and to sides. 回答1: You can use custom property on tooltip like this

Read google sheet json data into chartjs

99封情书 提交于 2021-01-28 05:43:36
问题 I have a google sheet with simple two colomns, one labels and the other is values. I succeeded to convert it into json, and using such values in tables using the following js $.getJSON("https://spreadsheets.google.com/feeds/list/1GnakUnNQvFXjuzMSPnBpU9eufb4SooQLGL2oFc3lfAs/od6/public/values?alt=json", function (data) { var sheetData = data.feed.entry; var i; for (i = 0; i < sheetData.length; i++) { var names = data.feed.entry[i]['gsx$names']['$t']; var numbers = data.feed.entry[i]['gsx

Angular Chart.js - Remove Moment.js as Dependency / Reduce Bundle Size

泄露秘密 提交于 2021-01-28 02:06:40
问题 I am using Chart.js with Angualar 7 . But Chart.js adds about 450KB to my bundle size. Through other resources I found out, that Moment.js is the main factor for the big size. "chart.js": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.7.3.tgz", "integrity": "sha512-3+7k/DbR92m6BsMUYP6M0dMsMVZpMnwkUyNSAbqolHKsbIzH2Q4LWVEHHYq7v0fmEV8whXE0DrjANulw9j2K5g==", "requires": { "chartjs-color": "^2.1.0", "moment": "^2.10.2" } }, I want to know how to remove moment

Switching between Charts with chart.js using Buttons

荒凉一梦 提交于 2021-01-27 17:00:52
问题 I am a beginner developer. I've been trying to use chartJS to get some data onto a screen. I'd like to be able to click a button that will generate another fresh set of data/axes. I've been trying to follow other stack overflow answers but none seem to work for me... please see below. <canvas id="myChart"></canvas> <canvas id="forecast" width="300" height="150"></canvas> <button id="0" type="button" >Overall (Monthly)</button> <button id="1" type="button" >Overall (Cumulative)</button>

Dotted lines using Chart.js

感情迁移 提交于 2021-01-27 11:59:59
问题 Is it possible to draw dotted lines using Chart.js? This is an example of what I want to do: The current options I'm using is not letting me do what I aim to do: var lineChartData = { "datasets": { "label": "defi score", "data": dataset[i], "pointStrokeColor": "#fff", "fillColor": "rgba(220,220,220,0.5)", "pointColor": "rgba(220,220,220,1)", "strokeColor": "rgba(220,220,220,1)", pointHighlightFill: "#19283F", pointHighlightStroke: "#28AFFA", bezierCurve: false }, "labels": labels }; var ctx =

Dotted lines using Chart.js

蹲街弑〆低调 提交于 2021-01-27 11:59:39
问题 Is it possible to draw dotted lines using Chart.js? This is an example of what I want to do: The current options I'm using is not letting me do what I aim to do: var lineChartData = { "datasets": { "label": "defi score", "data": dataset[i], "pointStrokeColor": "#fff", "fillColor": "rgba(220,220,220,0.5)", "pointColor": "rgba(220,220,220,1)", "strokeColor": "rgba(220,220,220,1)", pointHighlightFill: "#19283F", pointHighlightStroke: "#28AFFA", bezierCurve: false }, "labels": labels }; var ctx =