chart.js

Break axis in chart.js

我是研究僧i 提交于 2019-12-24 07:38:45
问题 I'm trying to display a line chart with a broken y-axis, using chart.js (2.3.0). In my chart, there's a fixed minimum value, which should always be shown as a label on the y-axis. I would then like to have the "empty space" between this minimum value and the minimum value in the dataset be removed. Is this possible to do? 来源: https://stackoverflow.com/questions/42343579/break-axis-in-chart-js

Angular 2 ng2-charts donut add horizontal line

家住魔仙堡 提交于 2019-12-24 07:03:36
问题 This is question related to link I managed to add text inside donut chart but I need now horizontal line that separates text inside chart. ngAfterViewInit() { Chart.pluginService.register({ afterDraw: function (chart) { if (chart.config.options.elements.center) { var helpers = Chart.helpers; var centerX = (chart.chartArea.left + chart.chartArea.right) / 2; var centerY = (chart.chartArea.top + chart.chartArea.bottom) / 2; var ctx = chart.chart.ctx; ctx.save(); var fontSize = helpers

ChartJS replay chart animation when called by show()

纵饮孤独 提交于 2019-12-24 06:26:31
问题 I have a page full of charts that automatically generates all charts available (because the default page is "All Charts"). In it, there's a select department tag that will hide all charts other than those owned by the selected department. Here's my code: $(window).load(function(){ $('#department').change(function(){ active_department($(this).val()); }); function active_department(department){ for(var i = 0; i < dept['namedept'].length; i++){ if(department!='All'){ $('.'+dept['namedept'][i])

ChartJS replay chart animation when called by show()

﹥>﹥吖頭↗ 提交于 2019-12-24 06:26:08
问题 I have a page full of charts that automatically generates all charts available (because the default page is "All Charts"). In it, there's a select department tag that will hide all charts other than those owned by the selected department. Here's my code: $(window).load(function(){ $('#department').change(function(){ active_department($(this).val()); }); function active_department(department){ for(var i = 0; i < dept['namedept'].length; i++){ if(department!='All'){ $('.'+dept['namedept'][i])

Chart.js version 2.5 tooltip align items horizontally

天大地大妈咪最大 提交于 2019-12-24 05:56:18
问题 I am working on chart.js version 2.5 Currently values are displaying vertical, i want to display horizontally. Some of the advance charts has 20 values. Please check the below attached image. Intended results: White or Caucasian and Black or African american in one row Asian other and Asian Japanese in another row tooltips: { mode: 'index', bodyFontSize: 14, titleFontSize: 14, xPadding: 20, yPadding: 20, multiKeyBackground: 'rgb(0,0,0)', callbacks: { label: function(tooltipItems, data) { var

Chart.js - show tooltip when hovering on legend

北城以北 提交于 2019-12-24 04:35:08
问题 I recently upgraded my version of Chart.js from v2.3 to v2.7.1 , which broke an existing functionality where the specified segment in a doughnut chart would be active (hover color, tooltip shown) when the user hovered over the corresponding legend item. That code looked like this: var " + ClientID + @" = new Chart(" + ClientID + @"CTX, { data: { ... }, options: { legend: { onHover: function(evt, legendItem) { var index = " + ClientID + @".data.labels.indexOf(legendItem.text); if (" + ClientID

Chartjs labels and legend

落爺英雄遲暮 提交于 2019-12-24 03:07:57
问题 I have an application which contains some ChartJS. Charts work well and legend is shown when mouse is hover the chart. How can I configure charts to have legend and labels value all the time on chart, not only when hover. 来源: https://stackoverflow.com/questions/38465624/chartjs-labels-and-legend

Chartjs - Donut Chart label for small values not visible

杀马特。学长 韩版系。学妹 提交于 2019-12-24 01:52:59
问题 Values for my Chart range from 10 to 70000. Since 70000 is too large, small values are not visible in the chart and I cannot view its label on hovering over it. Is it possible to show all labels, without having to hover or any better solution for this. fiddle: https://jsfiddle.net/Sanal_5/e6zdk6jt/4/ [https://jsfiddle.net/Sanal_5/e6zdk6jt/4/][1] 回答1: You could draw the legend for the pie chart by calling generateLegend on the created chart and add an event listen to highlight the segment when

Chart js: how can I align the legend and the title

跟風遠走 提交于 2019-12-24 00:56:09
问题 I want to align the orders to the left and the legends to center center. I've tried doing title:{ display:true, fontSize:18, text: "Products", titleAlign:'left' } but textalign doesn't seem to work for me nor the horizontal 回答1: Check the Chart.js docs, there is no options like titleAlign, see: https://www.chartjs.org/docs/latest/configuration/title.html. It should be in the future, there is an pull request for that: https://github.com/chartjs/Chart.js/pull/5866 . There is an option to do

How to retrieve data from mysql to chart.js

て烟熏妆下的殇ゞ 提交于 2019-12-24 00:43:51
问题 I want to create a pie chart with chart.js, but it can't display the chart. I spent a day trying to solve this problem, but there was no good result. I hope someone can help me. My database has different companies, I need to calculate the total sales of each company and display in the pie chart. I think the problem would be $results_sum = "SELECT SUM(total_of_gp_fee) AS Total FROM gp WHERE cshortcut =$subjectData('cshortcut')"; , since there has many sales record for different company and I