score:0
Accepted answer
ok, i figured it out. basically, i'm adding padding in beforeinit and then add description in beforedraw (only the essence here):
beforeinit: function (chart, options) {
let ispieordoughnut = chart.config.type === 'pie' || chart.config.type === 'doughnut';
if (ispieordoughnut) {
chart.options.scales.xaxes[0].gridlines.linewidth = 0;
chart.options.scales.xaxes[0].display = true;
}
chart.options.scales.xaxes[0].scalelabel.padding.bottom = 50;
},
beforedraw: function (chart, options) {
ctx = chart.chart.ctx;
ctx.restore();
ctx.font = "1em sans-serif";
let height = chart.chart.height;
ctx.filltext('description', 30, height - 35);
ctx.save();
}
Source: stackoverflow.com
Related Query
- Chart.js, adding footer to chart
- How to change font weight of footer in tooltips in Chart JS
- what is wrong with my code ? java script chart position
- How to print a chart rendered by code
- VueJS + Chartjs - Chart only renders after code change
- How do I destroy/update Chart Data in this chart.js code example?
- getting additional value fields from data source for dx.chartjs doughnut chart
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- Chart js footer
- Getting the HTML code of a chart created by chart.js
- How to run Chart.js samples using source code
- how to not repeat code while creating multiple charts in chart js
- Set height of chart in Chart.js
- Dynamically update values of a chartjs chart
- How to add text inside the doughnut chart using Chart.js?
- How to clear a chart from a canvas so that hover events cannot be triggered?
- In Chart.js set chart title, name of x axis and y axis?
- Limit labels number on Chart.js line chart
- Chart.js - How to set a line chart dataset as disabled on load
- chart js 2 how to set bar width
- How can labels/legends be added for all chart types in chart.js (chartjs.org)?
- Chartjs Bar Chart showing old data when hovering
- Chart.js Show labels on Pie chart
- Chart Js Change Label orientation on x-Axis for Line Charts
- Chart area background color chartjs
- Chart.js - Increase spacing between legend and chart
- Converting Chart.js canvas chart to image using .toDataUrl() results in blank image
- Draw horizontal line on chart in chart.js on v2
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- Remove the vertical line in the chart js line chart
More Query from same tag
- How to map json array to two different array for chart
- Chartjs - how to make line position to vertical center and how to display dotted sharp in the backround?
- Chart.js 2.0 doughnut tooltip percentages
- How to convert a bar legend to line legend in chart.js 2.7.2?
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- Bar Graph, chart.js PHP Will Not Load
- Chartjs change the specific label color in x axis in callback function
- Changing data when click button in chart.js/vue.js
- native element not defined when ngSwitch condition in canvas element
- Why is Chart js first bar too small or not showing at all?
- Is there a way to trigger point hit on an xAxis hover
- Chart.js pie chart not showing
- Can we draw a Line Chart with both solid and dotted line in it?
- How to rotate a linear graphic in chart.js?
- Chart JS - Make chart scrollable if too much data
- How to use Selenium with "chart.js"
- the graph in the view is not displayed - Chart.js Angularjs
- Show count concatenated to labels using chart.js
- Drill down charts dynamic functionality
- How to display multiple graphs in real time with chartjs
- toDataURL() gives checkered background to downloaded chart
- Chart.js is only displaying after f12 is pressed
- Want to show small part of js Bar Chart when value is zero
- Chart.js with dual axis incorrect starting points (if negative values)
- How to update chart when state changes in vue?
- Getting "Uncaught TypeError: Cannot read properties of undefined (reading 'map')" when using Chartjs inside react axios method
- ChartJS: Fixed width for data-part, the rest for labels
- How to add the value for each label to pie legend
- How to change font size of labeled scales in Chart.js?
- unable to pass data from views to js file having chart js codes, shows unexpected syntax error