chart.js

Modify the information box of the scatter chart in Chart.JS

守給你的承諾、 提交于 2020-06-01 09:23:42
问题 I'm working with a scatter chart in chart.js and I need to modify the info what I show when I'm above a point. I think the box that contains this information is called tooltip . Below I show what I have now, What I want to do is modify the first one, and put 14:52 like the x-axis. In the x-axis was easy, options: { scales: { xAxes: [{ type: 'linear', position: 'bottom', ticks: { callback: function(value, index, values) { var time = String(value); if (time.length == 3){ time = '0' + time; }

Modify the information box of the scatter chart in Chart.JS

自闭症网瘾萝莉.ら 提交于 2020-06-01 09:20:30
问题 I'm working with a scatter chart in chart.js and I need to modify the info what I show when I'm above a point. I think the box that contains this information is called tooltip . Below I show what I have now, What I want to do is modify the first one, and put 14:52 like the x-axis. In the x-axis was easy, options: { scales: { xAxes: [{ type: 'linear', position: 'bottom', ticks: { callback: function(value, index, values) { var time = String(value); if (time.length == 3){ time = '0' + time; }

How to draw one line with different colors in chartjs2?

喜你入骨 提交于 2020-06-01 08:08:06
问题 I need to draw a chart that looks like the one on the picture. How do I do that with chartjs2? Unfortunately, I couldn't find any examples that show how to implement it. 回答1: Did it like this in React for 2 lines: <Line data={{ labels: [100, 200, 300, 150, 250, 400], datasets: [ { label: 'My red line', fill: false, borderColor: 'red', data: [null, null, 2, 0, 3], }, { label: 'My green line', fill: false, borderColor: 'green', data: [2, 4, 2, null, null, null], }, ], }} /> 回答2: First convert

How to format x-axis based on how long between start and end time datepicker of data in chart.js?

自闭症网瘾萝莉.ら 提交于 2020-06-01 05:08:18
问题 Hello I am new to javascript. I have chart.js with the data from API look like this : .....//datepicker code...... $.ajax({ method: "GET", url: endpoint, data: { startDate: startDate, endDate: endDate }, success: function(data){ //get data by fields var accelero_x = [], timestamp = []; for (var i=0; i<data.length; i++){ accelero_x.push(data[i].accelero_x); timestamp.push(data[i].timestamp); } //plot the chart var ctx = document.getElementById("accelero_xChart").getContext('2d'); var accelero

How can I create a time series line graph in chart.js?

妖精的绣舞 提交于 2020-05-31 02:05:02
问题 I created a python script that fetches data from an API to get weather temperature at a certain time The result is a CSV file that looks like this: Time,Temperature 2020-02-15 18:37:39,-8.25 2020-02-15 19:07:39,-8.08 2020-02-15 19:37:39,-8.41 2020-02-15 20:07:39,-8.2 How can transform the CSV into a JavaScript array and make a Chart.js line chart out of it? Right now, I have a Chart.js base script that looks like this (isn't filled with any data) new Chart(document.getElementById("line-chart"

How can I create a time series line graph in chart.js?

烈酒焚心 提交于 2020-05-31 02:02:15
问题 I created a python script that fetches data from an API to get weather temperature at a certain time The result is a CSV file that looks like this: Time,Temperature 2020-02-15 18:37:39,-8.25 2020-02-15 19:07:39,-8.08 2020-02-15 19:37:39,-8.41 2020-02-15 20:07:39,-8.2 How can transform the CSV into a JavaScript array and make a Chart.js line chart out of it? Right now, I have a Chart.js base script that looks like this (isn't filled with any data) new Chart(document.getElementById("line-chart"

How can I create a time series line graph in chart.js?

一世执手 提交于 2020-05-31 01:59:29
问题 I created a python script that fetches data from an API to get weather temperature at a certain time The result is a CSV file that looks like this: Time,Temperature 2020-02-15 18:37:39,-8.25 2020-02-15 19:07:39,-8.08 2020-02-15 19:37:39,-8.41 2020-02-15 20:07:39,-8.2 How can transform the CSV into a JavaScript array and make a Chart.js line chart out of it? Right now, I have a Chart.js base script that looks like this (isn't filled with any data) new Chart(document.getElementById("line-chart"

How to get click event in Chart.js

牧云@^-^@ 提交于 2020-05-29 08:00:47
问题 I have Bar chart and Pie Chart to drew using Chart.js.I hope that display Popup Window when it click specific title bar. Example: I have bar chart a. (label name : Apple, Strawberry, Banana, Mango, Grape, Oragne) I clicked specific label of several labels a. (click: Apple, Total amount of Apple : 7ea) Then a pop-up window that use the value passed to the parameter URL will appear, showing more information about the apple inside. a. (Korea apple: 1ea, America apple: 3ea, China apple: 2ea,

Chart.js Custom Image for Each Point

≯℡__Kan透↙ 提交于 2020-05-28 14:07:35
问题 I'm using Chart.js and I'm looking for help with custom images for each point on a scatter graph. I've tried using a javascript array of images but it isn't working. I'm new to canvas and html5. What I would like is for each point to be a small profile picture of the user instead of a circle. An example would be greatly appreciated. I currently have: var ctx = document.getElementById("member-graph-scatter"); var myChart = new Chart(ctx, { type: 'line', data: { datasets: [{ label: 'Miles /

Chartjs change grid line color

[亡魂溺海] 提交于 2020-05-24 08:52:27
问题 First I don't know what's it called. But how do you change its color from gray to white? Or is it even possibe? 回答1: It is possible to either remove the grid lines or have them display in a different color. In both options.scales.xAxes and options.scales.yAxes you can add gridLines: { display: false , color: "#FFFFFF" }, (obviously you do not need to assign a colour if you are not disaplying them) var chartColors = { red: 'rgb(255, 99, 132)', orange: 'rgb(255, 159, 64)', yellow: 'rgb(255, 205