chart.js

Chartjs / ng2-charts line on hover does not work

非 Y 不嫁゛ 提交于 2020-01-24 20:31:05
问题 I'm trying to optimize my chart using ng2-charts on Angular cli app. In general, everything works just fine, the only thing does not is the line on hover to track the data point. This is the ideal chart model I try to make and I also tried to follow its code: https://stackblitz.com/edit/line-chart?file=app%2Fapp.component.ts However, when I hover on my chart, only the tooltip is shown. Here are my codes: plugin-hoverline.ts: (copy & paste from the link below, credit by @GRUNT) https://istack

Chart.js number Y-AXIS label format for many decimal places

淺唱寂寞╮ 提交于 2020-01-24 05:25:26
问题 I'm having problems with chart.js Y-axis labels. I have the following data. var data = { labels: ["1","2","3","4","5"], datasets: [ { label: "My First dataset", fillColor: "rgba(220,220,220,0.5)", strokeColor: "rgba(220,220,220,0.8)", highlightFill: "rgba(220,220,220,0.75)", highlightStroke: "rgba(220,220,220,1)", data: [0.15000000000000088,0.15000000000000133,0.15000000000000177,0.15000000000000221,0.15000000000000308] }, ] }; and I get this result. Image of the Graph Result As you can see

React render Chart.js based on api response

半城伤御伤魂 提交于 2020-01-23 17:14:08
问题 I am using reacts and chart.js, and the chart-js/react wrapper. I am dynamically pulling the data from an API and then basing the chart on the data returned. The issue is that it is only one name from the API call that is being displayed in the graph. There should be three names. I think the problem is that the rendering of the Graph component is being rendered before all the data has been returned by the API, so the graph only contains the first name. At least this is what i think. I have

How can i create a background of moving graphs like chartsjs?

谁说胖子不能爱 提交于 2020-01-23 12:33:56
问题 If i go into the website http://www.chartjs.org/ , I see the wallpaper of moving graphs as shown: What i want to achieve is the moving graph wallpaper behind these texts and buttons. I was wondering how do i achieve that on my website? Is it a real graph? Or just an animated picutre? Thanks ! 回答1: This is an accual chart made in Chart.JS, note when you inspect that element it is on a <canvas id="hero-bar"> . Then you can find how that chart works by looking in the JavaScript for the element

How do you hide the title of a chart tooltip?

删除回忆录丶 提交于 2020-01-22 18:56:07
问题 I'm using chart js to show grouped bar chart and try to hide the title of the tooltip Code to generate bar var ctx = document.getElementById("myChart").getContext("2d"); var data = { labels: ["Chocolate", "Vanilla", "Strawberry"], datasets: [ { label: "Blue", backgroundColor: "blue", data: [3,7,4] }, { label: "Red", backgroundColor: "red", data: [4,3,5] }, { label: "Green", backgroundColor: "green", data: [7,2,6] } ] }; var myBarChart = new Chart(ctx, { type: 'bar', data: data, options: {

Where put “multiTooltipTemplate” in Chart.js v2.x

点点圈 提交于 2020-01-21 08:19:26
问题 i want to change the "label" for the "datasetlabel" width "multiTooltipTemplate". But i find the solution only for the previous version of chart.js Can you tell me how to convert this : multiTooltipTemplate: "<%%=datasetLabel%> : <%%= value %>", To the version 2 of Chart.js For now i got this in option : options: { tooltips: { enabled: true, mode: 'single', callbacks: { label: function(tooltipItems, data) { return tooltipItems.yLabel + ' €'; } } }, } Thanks for helping 回答1: Your options

ChartJS onclick fill area (Radar Chart)

自作多情 提交于 2020-01-17 07:26:10
问题 I'm trying to create a function in JQuery that increase and decrease the points clicked. I've managed to create the onclick event that increases the points, but can't figure out how to decrease it. $("#radarChart").click( function (evt) { var activePoints = myRadarChart.getPointsAtEvent(evt); var Values = activePoints[0].label + ' = ' + activePoints[0].value; activePoints[0].value++; } ); The above function increases the value of a point when clicked, in order to decrease it I need to know if

Updating ng-charts barchart datasets in angular 2

别说谁变了你拦得住时间么 提交于 2020-01-17 06:45:46
问题 How to update barchart from angular2? I am trying to add new entry on click to [datasets]="barChartData" In template, graph looks like this: <canvas baseChart #myChart [datasets]="barChartData" [labels]="barChartLabels" [options]="barChartOptions" [legend]="barChartLegend" [chartType]="barChartType" (chartHover)="chartHovered($event)" (chartClick)="chartClicked($event)"></canvas> I tried following recommended methods: 1) Changed dataset variable directly - cloned the data , changed it and

change legend item style when dataset is hidden

╄→гoц情女王★ 提交于 2020-01-17 06:33:36
问题 Hey I'm using the awesome Chart.js library and I would like to customize the style of the legend item. For now, when dataset is hidden, in the legend we can see a line through. I would like to set text opacity for example instead. How to change this please ? Thanks for your help 回答1: Unfortunately, there is no real easy way to do this if you are planning to use the automatically generated Legend that chart.js provides. It is possible though. If you read through the source, you will find that

Chart.js dynamic bar width

孤街浪徒 提交于 2020-01-17 05:31:05
问题 I have a requirement to render a set of time series data of contiguous blocks. I need to describe a series of bars which could span many hours, or just minutes, with their own Y value. I'm not sure if ChartJS is what I should be using for this, but I have looked at extending the Bar type, but it seems very hard coded for each bar to be the same width. The Scale Class internally is used for labels, chart width etc, not just the bars themselves. I am trying to achieve something like this that