chart.js

Chart.js stacked bar ordering depending on value

霸气de小男生 提交于 2021-02-10 14:53:21
问题 I have a stacked bar but I want to order the bars based on the summed value of my two datasets. Does any one have any idea how to do this using chart.js functionality? See here data: { labels: stores, datasets: [ { label: 'Rev', data: dataPack1, backgroundColor: "rgba(55, 160, 225, 0.7)", hoverBackgroundColor: "rgba(55, 160, 225, 0.7)", hoverBorderWidth: 2, hoverBorderColor: 'lightgrey' }, { label: 'Tax1', data: dataPack2, backgroundColor: "rgba(225, 58, 55, 0.7)", hoverBackgroundColor: "rgba

Chartjs pie chart out side border

落爺英雄遲暮 提交于 2021-02-10 14:48:41
问题 I ask for help! I need get this result in chartsjs but I can’t understand how i can make a color line along only one border (red and black in this image). At the moment, I have just such a code, in which all cells have a common color, and all borders of arc are painted in other colors. But in this case, the internal lines also become the color of the border, which does not suit me (i need do it white) :( $(document).ready(function () { var ctx = document.getElementById("chartjs-1").getContext

Issue with chartjs linear gradient for the mixed bar chart in ReactJS is not calculated for each individual Bars

…衆ロ難τιáo~ 提交于 2021-02-10 14:39:04
问题 Our requirement is to render the bar chart as Expected Image. we are using chartJs library to render the chart. we are able to render the bar chart but for one of the bar we need to show the background color as gradient. To achieve this we used the following below code snippet: but it render as Rendered graph. Can you please help me out in rendering the chart as expected. JSFiddleLink const data = [{ type: "Sample 1", data: [600, 400, 200, 800] }, { type: "Sampel 2", data: [700, 300, 600, 600

ChartJS not displaying time data using Moment.js

社会主义新天地 提交于 2021-02-10 14:24:47
问题 I am trying to map out a series of data points on a given day by the hour. Not every hour is included in the data set, however I still want to show the time from 0:00 - 23:00 and plot the data points that is available. My error is This method is not implemented: either no adapter can be found or an incomplete integration was provided. However, Looking at the documentation and this tutorial, I still get the error. In my hourlyData set, x is the hour and y is the amount. Can anyone see what I

Multiple charts in one page with chart.js

自作多情 提交于 2021-02-10 13:31:15
问题 I use chart.js and its dependency, jQuery to draw chart. In my case, I need 2 doughnut charts in one of my page, here's my code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <script src="https://code.jquery.com/jquery-3.3.1.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.js"></script> <title>Document</title>

Y-Axis with different colors

安稳与你 提交于 2021-02-10 05:23:43
问题 I have tried to add different colors to the Y-axis but without success. Is it possible to achive something like attached image shows? In the chartjs-plugin-annotation plugin you can set the background but not scale colors. Describing image var config = { type: 'line', data: { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ label: 'Dataset', data: [1,2,3,4,5,6,7], fill: false, }] }, options: { responsive: true, scales: { yAxes: [{ display: true,

Y-Axis with different colors

一世执手 提交于 2021-02-10 05:21:08
问题 I have tried to add different colors to the Y-axis but without success. Is it possible to achive something like attached image shows? In the chartjs-plugin-annotation plugin you can set the background but not scale colors. Describing image var config = { type: 'line', data: { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ label: 'Dataset', data: [1,2,3,4,5,6,7], fill: false, }] }, options: { responsive: true, scales: { yAxes: [{ display: true,

Y-Axis with different colors

狂风中的少年 提交于 2021-02-10 05:20:09
问题 I have tried to add different colors to the Y-axis but without success. Is it possible to achive something like attached image shows? In the chartjs-plugin-annotation plugin you can set the background but not scale colors. Describing image var config = { type: 'line', data: { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [{ label: 'Dataset', data: [1,2,3,4,5,6,7], fill: false, }] }, options: { responsive: true, scales: { yAxes: [{ display: true,

Overlapping Bar Chart using Chart.js

放肆的年华 提交于 2021-02-08 13:41:48
问题 I want to develop a bar chart as shown below is it possible to develop it using chart.js? 回答1: Yes this is possible, see examples in this thread on Github https://github.com/chartjs/Chart.js/issues/5224. Notice the comment relating to offset, which will apply to versions of Chart js > 2.4. 来源: https://stackoverflow.com/questions/43271197/overlapping-bar-chart-using-chart-js

chart.js bar chart change color based on value

梦想与她 提交于 2021-02-08 10:18:51
问题 function argMax(array) { return array.map((x, i) => [x, i]).reduce((r, a) => (a[0] > r[0] ? a : r))[1]; } // dummy data var data = [12, 19, 1, 14, 3, 10, 9]; var labels = data.map((x, i) => i.toString()); // other data color var color = data.map(x => 'rgba(75,192,192,0.4)'); // change max color color[argMax(data)] = 'red'; var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: labels, datasets: [{ label: 'value', data: data, backgroundColor: