charts

Automatic colors assignment in chart.js 2.x doesn't work anymore, used to work in v. 1.x

放肆的年华 提交于 2020-01-30 14:30:09
问题 Using Chart.js 1.x I could create a pie chart and get the colors automatically assigned: <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.1.1/Chart.js"></script> <body> <canvas id="myChart" width="400" height="400"></canvas> <script> var ctx = document.getElementById("myChart").getContext("2d"); var data = [{"label":"Conservative","value":"5"},{"label":"Democratic","value":"6"}]; var myChart = new Chart(ctx).Pie(data); </script> </body> if I do the same with v 2.x <script src=

Display Dynamic Data in Angular6 with GoogleChart

[亡魂溺海] 提交于 2020-01-30 11:35:27
问题 I use Angular Cli6, angularfire2 and firebase. I want to create a timeline with GoogleChart. //GoogleChart.service declare var google: any; export class GoogleChartsBaseService { constructor() { google.charts.load('current', {'packages':["timeline"]}); } protected buildChart(data: any[], chartFunc: any, options: any) : void { var func = (chartFunc, options) => { var datatable = google.visualization.arrayToDataTable(data); chartFunc().draw(datatable, options); }; var callback = () => func

Chart.js Picture inside doughnut segment

你。 提交于 2020-01-30 10:56:09
问题 I found out about chart.js and I am looking to use a doughnut chart for my website, I found a example where I can take the basics from : https://jsfiddle.net/9wp4f693/2/ I've only found something like this, but it was to draw text inside the segments, not to add pictures. function drawSegmentValues() { for(var i=0; i<myDoughnutChart.segments.length; i++) { ctx.fillStyle="white"; var textSize = myChart.width/10; ctx.font= textSize+"px Verdana"; // Get needed variables var value =

Chart.js Picture inside doughnut segment

扶醉桌前 提交于 2020-01-30 10:56:07
问题 I found out about chart.js and I am looking to use a doughnut chart for my website, I found a example where I can take the basics from : https://jsfiddle.net/9wp4f693/2/ I've only found something like this, but it was to draw text inside the segments, not to add pictures. function drawSegmentValues() { for(var i=0; i<myDoughnutChart.segments.length; i++) { ctx.fillStyle="white"; var textSize = myChart.width/10; ctx.font= textSize+"px Verdana"; // Get needed variables var value =

Google Chart vAxis values are not showing

核能气质少年 提交于 2020-01-30 09:42:26
问题 I am working on various graphs and I am showing multiple graphs in a single page. Somehow vAxis values are not showing on some graphs but it showing in some independent (we can say its in different section and triggered manually) graphs. I have tried everything that I could have. var data = google.visualization.arrayToDataTable(window.item); let options = { width: 1410, height: 400, legend: {position: 'right'}, bar: {groupWidth: '75%'}, isStacked: true, vAxis: { minValue: 0, title: 'Count',

Google Charts: How to pass a parameter into a callback (JavaScript)?

一世执手 提交于 2020-01-30 08:45:39
问题 I have a following code: google.charts.setOnLoadCallback( drawChart ); function drawChart() { ... } I need to pass a parameter called chartID into a drawChart() function. How can I do it? Seems google chart doesn't want to get any params :) Any ideas? 回答1: one way is to add another function... google.charts.setOnLoadCallback(function () { drawChart(chartID); }); function drawChart(chartID) { ... } 来源: https://stackoverflow.com/questions/45255690/google-charts-how-to-pass-a-parameter-into-a

How to use a csv file with the google chart API?

試著忘記壹切 提交于 2020-01-30 08:30:06
问题 I have a csv file with that : Site,Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Décembre CITROEN VILLEFRANCHE CARROSSERIE,0,0,14,0,18,21,0,0,0,0,0,0 CITROEN VILLEFRANCHE ,240,237,230,264,219,285,219,130,4,0,0,0 NISSAN VILLEFRANCHE ,174,202,215,181,196,244,203,107,10,1,0,0 I would like to see its data in a column chart. But i do not know how to read the data of a csv with the API. Here is an example of a column chart with the API : google.charts.load("current",

What JavaScript code would I use to plot a trend line?

只谈情不闲聊 提交于 2020-01-30 08:17:25
问题 Assuming that I have the following values that I'm going to plot on a Line chart (these are values and not coordinates - the coordinates are calculated by my software and are shown below): [4,4,3,2,5,5] How would I turn those values into a set of trendline values/coordinates? (BTW I don't really have any Maths expertise beyond school level - so no fancy Maths terminology please!). To add further details: These are a set of values that are spaced equally across a 500 pixel space (an HTML5

MPAndroidChart how to change the color of the bar chart past the limit line?

时光毁灭记忆、已成空白 提交于 2020-01-26 03:55:07
问题 How to change the color of the bar chart past the limit line? Now, bars that cross the limit line change color. But, I want to change the color of the part cross the limit line. 回答1: I think you can achieve that with stackedBarChart . Here in the docs you can see how to add the data for each bar. With this, you will set the data for a barchart as follows: BarEntry(xPosition, floatArray(belowLineNumber, aboverLineNumber) For the colors, you just need to add a list of colors fot the data set

Declare function inside another function in angularjs

十年热恋 提交于 2020-01-25 21:52:08
问题 I have my first function: $scope.loadDataFromToMonth= function (from,to,year) { // $scope.loadDataFromToMonthArrivee(from,to,2016); var url = servername+'admin/dashboard/getIncidentDepartByMonthFromTo/'+from+'/'+to+'/'+year; // alert(url); function onSuccess(response) { console.log("+++++getIncidentDepartByMonthFromTo SUCCESS++++++"); if (response.data.success != false) { $scope.payloadgetIncidentDepartByMonthFromTo = response.data.data; var getIncidentDepartByMonthFromTo= $scope