chart.js

How can I sort, insert in between and update full dataset in chartjs?

[亡魂溺海] 提交于 2019-12-30 07:11:43
问题 I have a few issues with chartjs which simple update method won't solve. I wonder if there is an option to: painlessly sort the datasets; insert some data in between two points; reload the whole chart without replacing the canvas with a completely new chart? 回答1: There is no option built in, but it is pretty easy to write your own using the addData , removeData methods that Chart.js provides. var MyBarChartMethods = { // sort a dataset sort: function (chart, datasetIndex) { var data = []

ChartJS Line Graph - Multiple Lines, Show one Value on Tooltip

落花浮王杯 提交于 2019-12-30 03:14:26
问题 I'm trying to make a Graph which has to show the Account movement from each Customer. What I'm trying to do I've tree lines ; First line : The minimum balance, if the customer has less than the min. balance, his balance will auto load from his bank account. Second Line : The current balance Third Line: The maximum balance : If the customer has more than the max. balance he will become the difference from the system on his bank account. My Problem Link to the picture : chartjs tooltip problem

How to have solid colored bars in angular-chart bar chart

浪子不回头ぞ 提交于 2019-12-29 08:43:12
问题 I'm using angular-chart (based on chart.js) to create some bar charts and am having trouble getting the bar styling I want. I want the bars to be solid colors like this: But I can't figure out how to get rid of the alpha that chart.js adds by default: My html looks like this: <body ng-app="myApp" ng-controller="myController as ctrl"> <canvas id="outreach" class="chart chart-bar" chart-labels="ctrl.socialChart.labels" chart-data="ctrl.socialChart.data" chart-series="ctrl.socialChart.series"

How do I invert an y-axis using chart.js (v2.0-dev)

我只是一个虾纸丫 提交于 2019-12-29 06:45:37
问题 I am creating line charts with 2 y-axes. one of those axes has two datasets but both run from the range of 0-100. The higher number being the better one. The second y-axis is usually lower in range (often in the single digits) and the best result is 1. How can I invert the second y-axis so that 1 is at the top of the chart? (I will try to find a solution myself, but at 5k+ lines in chart.js, it might take a while ) Thanks ^_^ 回答1: Dev 2.0 of chart js supports an option to reverse the ticks

Chart.js - How to set a line chart dataset as disabled on load

爷,独闯天下 提交于 2019-12-29 06:34:27
问题 Using chart.js v2, is it possible to mark a dataset in a line chart as being disabled on initial load? Didn't find an option for it in the documentation. 回答1: Yes, there is a "hidden" flag in ChartJS. eg. data: { datasets: [ { data: [1,2,3], label: 'My First Dataset', hidden: true, }, ], } See this issue on GitHub: https://github.com/chartjs/Chart.js/issues/689 回答2: If you are using angular-chartjs , then you can add the properties of the dataset in the chart-dataset-override property: For

Chart.js Doughnut with rounded edges

自闭症网瘾萝莉.ら 提交于 2019-12-29 06:21:29
问题 I created a donut chart with Chart.js and I want it to have rounded edges at both ends. I want it to be like this: But I have it like this, with sharp edges: The best I found was this answer: How to put rounded corners on a Chart.js Bar chart, but it is for bar charts, and I have no clue of how to adapt it for doughnuts.. Here is my code: HTML <div class="modal-div-canvas js-chart"> <div class="chart-canvas"> <canvas id="openedCanvas" width="1" height="1"></canvas> <div class="chart

chart.js Failed to create chart: can't acquire context from the given item

℡╲_俬逩灬. 提交于 2019-12-28 14:05:29
问题 I never got into node so I am pretty sure I am doing something massively wrong here since I cannot find any info at all by googling. I have a django site and I wanted a JS charting library, I chose chart.js. I installed and like the docs, but after that I am unsure of what to do so I tried to fill in the blanks and follow their guide as much as possible. Here is what my html looks like.... <script src="/public/node_modules/chart.js/dist/Chart.js"></script> <canvas id="myChart" width="400"

Chart.js multiTooltip labels

房东的猫 提交于 2019-12-28 08:01:06
问题 I'm trying to get charts.js to display the label name from each dataset in the tooltip. My code: var barChartData = { labels : ["January","February","March","April","May","June","July"], datasets : [ { label: "Bob", fillColor : "rgba(88,196,246,0.5)", strokeColor : "rgba(88,196,246,0.8)", highlightFill: "rgba(88,196,246,0.75)", highlightStroke: "rgba(88,196,246,1)", data : [randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor(),randomScalingFactor()

Chart.js: evenly distribute ticks when using maxTicksLimit

隐身守侯 提交于 2019-12-28 05:53:45
问题 I made a line chart using Chart.js version 2.1.3. var canvas = $('#gold_chart').get(0); var ctx = canvas.getContext('2d'); var fillPatternGold = ctx.createLinearGradient(0, 0, 0, canvas.height); fillPatternGold.addColorStop(0, '#fdca55'); fillPatternGold.addColorStop(1, '#ffffff'); var goldChart = new Chart(ctx, { type: 'line', animation: false, data: { labels: dates, datasets: [{ label: '', data: prices, pointRadius: 0, borderWidth: 1, borderColor: '#a97f35', backgroundColor: fillPatternGold

how to display data values on Chart.js

╄→гoц情女王★ 提交于 2019-12-27 10:39:11
问题 I would like to ask if it's possible using Chart.js to display data values? I want to print the graph. Thanks for any advice. 回答1: Late edit: there is an official plugin for Chart.js 2.7.0+ to do this: https://github.com/chartjs/chartjs-plugin-datalabels Original answer: You can loop through the points / bars onAnimationComplete and display the values Preview HTML <canvas id="myChart1" height="300" width="500"></canvas> <canvas id="myChart2" height="300" width="500"></canvas> Script var