// ===================================== doughtnut chart random color function DoughtnutChartColor() { r = Math.floor(Math.random() * 200); g = Math.floor(Math.random() * 200); b = Math.floor(Math.random() * 200); return 'rgb(' + r + ', ' + g + ', ' + b + ',1.0)'; } // ===================================== doughtnut chart function DoughtnutChart(canvas_nm,data) { var ctx = $("#"+canvas_nm+"_doughtnut_chart"); var options = { responsive: true, title: { display: true, position: "top", text: "¿ø¾Æ±¸¼º", fontSize: 18, fontColor: "#111" }, legend: { display: true, position: "bottom", labels: { fontColor: "#333", fontSize: 16 } } }; //create Chart class object var chart = new Chart(ctx, { type: "doughnut", data: data, options: options }); } // ===================================== bar chart function HbarChart(canvas_nm,data) { var ctx = $("#"+canvas_nm+"_hbar_chart"); var options = { responsive: true, legend: { display: false } }; var myBarChart = new Chart(ctx, { type: 'horizontalBar', data: data, options: options }); } // ===================================== line chart function LineChart(canvas_nm,data) { $("#"+canvas_nm).remove(); $('.rpChart_container').append(""); var ctx = $("#"+canvas_nm); var options = { //animation: false, responsive: true, maintainAspectRatio: true, tooltips: { mode: 'label', callbacks: { label: function(t, d) { var xLabel = d.datasets[t.datasetIndex].label; var yLabel = t.yLabel; return xLabel+"\n"+js_num2han(yLabel*10000); } } }, scales: { xAxes: [{ ticks: { callback: function(tick, index, array) { return (index % 3) ? "" : tick; }, fontSize: 8, autoSkip: true, maxRotation: 0, minRotation: 0 }, gridLines: { borderDash: [5, 5], color: "#efefef" } }], yAxes: [{ ticks: { callback: function(tick, index, array) { return js_num2han(tick*10000); } }, gridLines: { borderDash: [5, 5], color: "#efefef" } }] }, elements: { point: { radius: 0, hitRadius: 10, hoverRadius: 5, } } }; line_chart_data = { type: 'line', data: data, options: options } line_chart = new Chart(ctx, line_chart_data); } // ===================================== add line chart function AddLineChart(fc, place_nm, cost) { if( fc == '°æ¸Å' ) newColor = "#bbae79"; else if( fc == '¿¹Á¤' ) newColor = "#92aff5"; else if( fc == '¸Å¹°' ) newColor = "#cf5b7a"; else if( fc == '°ø¸Å' ) newColor = "#e4a9d3"; else newColor = "#3e95cd"; newDataset = { label: fc+" "+place_nm, backgroundColor: newColor, borderColor: newColor, data: [], fill: false }; for (var index = 0; index < line_chart_data.data.labels.length; ++index) { newDataset.data.push(cost); } line_chart_data.data.datasets.push(newDataset); window.line_chart.update(); }