chart.js

Django and ChartJS

大憨熊 提交于 2020-01-01 05:46:08
问题 I'm trying to understand if it it's possible to incorporate dynamic data into a Django Chart JS architecture. I went through a couple of tutorials and ultimately got Django to work with ChartJS and it's very good when I'm able to hard code values and then display the related graphs. What I'm ultimately trying to do is this same exercise with dynamic data from my database. I found this identical question in SO, https://stackoverflow.com/questions/47575896/dynamic-chart-using-django-and-chart

ChartJS - Donut charts with multiple rings

风流意气都作罢 提交于 2020-01-01 05:16:11
问题 Is it possible to create a donut chart with multiple rings using ChartJS as shown below? 回答1: You can find out the solution at fiddle link var ctx = document.getElementById("chart-area").getContext("2d"); var myDoughnut = new Chart(ctx, config); var config = { type: 'doughnut', data: { datasets: [{ data: [ 10,20,30 ], backgroundColor: [ "#F7464A", "#46BFBD", "#FDB45C" ], }, { data: [ randomScalingFactor(), randomScalingFactor(), randomScalingFactor() ], backgroundColor: [ "#F7464A", "#46BFBD"

How get sum of total values in stackedBar ChartJs

核能气质少年 提交于 2020-01-01 04:52:09
问题 I'm trying to get the sum of all values of a stackedBar and include this total in tooltip. Note: my datasets aren't static, this is an example var barChartData = { labels: ["January", "February", "March", "April", "May", "June", "July"], datasets: [{ label: 'Corporation 1', backgroundColor: "rgba(220,220,220,0.5)", data: [50, 40, 23, 45, 67, 78, 23] }, { label: 'Corporation 2', backgroundColor: "rgba(151,187,205,0.5)", data: [50, 40, 78, 23, 23, 45, 67] }, { label: 'Corporation 3',

How do I draw a vertical line on a horizontal bar chart with ChartJS?

守給你的承諾、 提交于 2020-01-01 03:19:06
问题 There are many examples of extending a Chart to include a line, both horizontal and vertical. However, I have not found a way to draw a vertical line with a horizontal bar chart. Horizontal line on horizontal line chart Vertical line on horizontal line chart Horizontal line on vertical bar chart There is not a "vertical line chart" option like there is a "horizontal bar chart" option. How do I combine a horizontal bar chart with a vertical line? Chart.js documentation The result would have a

How can labels/legends be added for all chart types in chart.js (chartjs.org)?

会有一股神秘感。 提交于 2019-12-31 17:37:13
问题 The documentation for chart.js mentions "legend templates" but gives no resources or examples of such legends. How can these be displayed? 回答1: You can include a legend template in the chart options: //legendTemplate takes a template as a string, you can populate the template with values from your dataset var options = { legendTemplate : '<ul>' +'<% for (var i=0; i<datasets.length; i++) { %>' +'<li>' +'<span style=\"background-color:<%=datasets[i].lineColor%>\"></span>' +'<% if (datasets[i]

How to disable a tooltip for a specific dataset in ChartJS

末鹿安然 提交于 2019-12-30 18:51:28
问题 I displaying a chart where two types are included. Now I want to hide the toolbar for one dataset. I saw some discussion like this on GitHub, but this doesn't bring me further. Here is an example of my Chart: Chart.defaults.global.legend.display = false; var ctx = document.getElementById("chart").getContext("2d"); var data = { labels: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"], datasets: [ { label: "Test", type: 'bar',

How can I show a subset of data on pie pieces in Chart.JS while still displaying the superset when hovering?

▼魔方 西西 提交于 2019-12-30 13:37:12
问题 I've got a pie chart that looks like this when hovering over a piece of pie: Except for wanting the legend to the right instead of on top, I'm fairly content with this, but I want just the percentage value to display "all the time" in the pie pieces - and still have the <name> (<%val>): <data> displayed on hover. In other words, I want the pie to look something like this: How can I break that one piece of data out (the percentage) and draw that onto each piece of pie? Here is the code I'm

Highlight a particular point in chart JS

可紊 提交于 2019-12-30 07:49:20
问题 enter image description hereI want to highlight a particular point in chartjs and I want x and y axis interception at the data points in chart js . The point (753.17,126.52) should be high lightened with marker where the rest of the point should not high lightened in the line chart . Below is the image I want to create a chart as the below . <apex:page > <apex:includeScript value="{!$Resource.Chartjs}"/> <script language="JavaScript"> window.onload = function displayLineChart() { var data = {

Chart.js shaded regions

只谈情不闲聊 提交于 2019-12-30 07:48:25
问题 Chart.js (http://www.chartjs.org/docs/) can fill the color below line charts using the "fillColor" attribute (filling the region between the line chart itself and the x-axis). What I'd like to know is whether Chart.js can be configured to create shaded regions such as the one shown below: http://peltiertech.com/Excel/pix5/HorizBands09.png Thank you. 回答1: Shaded Regions for Line Charts You can extend the chart to do this. Preview or Script Chart.types.Line.extend({ name: "LineAlt", initialize:

Chart.js shaded regions

痴心易碎 提交于 2019-12-30 07:48:15
问题 Chart.js (http://www.chartjs.org/docs/) can fill the color below line charts using the "fillColor" attribute (filling the region between the line chart itself and the x-axis). What I'd like to know is whether Chart.js can be configured to create shaded regions such as the one shown below: http://peltiertech.com/Excel/pix5/HorizBands09.png Thank you. 回答1: Shaded Regions for Line Charts You can extend the chart to do this. Preview or Script Chart.types.Line.extend({ name: "LineAlt", initialize: