score:1
ChartJS is a good, but simple charting library.
Rather than modifying the source code of ChartJS to display your custom legends, it's probably easier for you to create your bar chart in native html canvas using lines and rectangles.
William Malone does a good job describing barcharts here:
http://www.williammalone.com/articles/html5-canvas-javascript-bar-graph/
Whether you decide to customize ChartJS or "roll your own", here is code to draw text rotated vertically and centered at a specified X,Y:
var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
var cw=canvas.width;
var ch=canvas.height;
var x=50;
var y=50;
var width=75;
var height=200;
ctx.strokeRect(x,y,width,height);
vertCenteredText(x+width*1/3,y+height/2,'Arrived On-Time');
vertCenteredText(x+width*1/2,y+height/2,'Logged-In On-Time');
vertCenteredText(x+width*2/3,y+height/2,'Tasks Completed On-Time');
function vertCenteredText(x,y,text){
var ta=ctx.textAlign;
var tb=ctx.textBaseline;
ctx.translate(x,y);
ctx.rotate(-Math.PI/2);
ctx.textAlign='center';
ctx.textBaseline='middle';
ctx.fillText(text,0,0);
// clean up by undoing our changes to canvas state
ctx.setTransform(1,0,0,1,0,0);
ctx.textAlign=ta;
ctx.textBaseline=tb;
}
body{ background-color: ivory; }
#canvas{border:1px solid red;}
<canvas id="canvas" width=300 height=300></canvas>
Source: stackoverflow.com
Related Query
- How to show the chartjs bar chart data values labels as text?
- How to show data values or index labels in ChartJs (Latest Version)
- How to show data values in top of bar chart and line chart in chart.js 3
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to start the chart from specific time and offest hour and then show the data on chart from target datetime in chartjs
- chart js tooltip how to control the data that show
- PrimeNg bar chart how to show a label for the y-axis
- Show Data labels on Bar in ChartJS
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- Angular chart how to show the legend data value by default along with legend name
- How to commaize the data values provided to a chart in Chart.JS?
- Chart.js: How to get x-axis labels to show on top of bars in bar chart
- How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js
- Chart.JS: How can I only display data labels when the bar width is big enough for the text?
- How to set the chartjs bar graph scale to the highest value in the result data
- Display Bar chart values in the graph - ChartJS
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- ChartJS - Show values in the center of each bar
- How to set the gap between data items in a chartjs chart
- How to show tooltip value of all data falling on the same axis in chart js?
- How to get the data attribute of the canvas chart created using chartjs
- How to show labels beside the bar in Char js 2?
- how can i show labels and value in both on bar chart
- How to add labels on top of the chart bar with Chart.js 2
- Using number/text input field to set the data values in ChartJs stops the chart from being displayed
- Chartjs - Stacked bar chart data order causes invisible other values
- how to show bar value on the top of each bar in chartjs
- How can I get my Chart.JS bar chart to stack two data values together on each bar, and print a calculated value on each bar?
- How to stop displaying the data values from different data objects on Chart JS 2.x?
- how to write labels along with data on top and bottom of each stack in bar chart
More Query from same tag
- How to update Chartjs chart (react-chartjs-2) with dynamic data?
- how resetZoom() en multiple charts (ng2charts or chartjs)?
- Stack grouped xAxes in bar chart
- How to modify bar width in Chartjs 2 bar charts
- How to create a scatter plot where x-axis represents a day by hours with datetime object? chartJS
- Chart is not defined Node.js Chart.js
- Limit labesl on chart.js bar chart
- How to display Tooltip without hovering pie chart with Chart.JS
- ChatJS 2.8.0 min/max axis issue and labels on the top
- Can't reuse a template in Vue.js
- In ChartJS how do I change the color of a label in the legend?
- Chartjs: Multiple data values for the same label
- Calling a TypeScript function from a Chart.js option callback
- Cant pass variable for some reason? PHP
- How to load chart data to an appended canvas
- Redraw Chart.js Chart with Json_encoded array from ajax request
- Add percentage to label badge - doughnut chart.js
- ChartJS with React: Only one value showing on time chart
- Zoom Function For Chart.js
- Chart bundle js is not showing dynamic data
- How to insert multiple values in Charts.js inside one title?
- How to change format of DateTime reading into chart.js chart?
- I'm new to node.js, and I'm working on getting a pie chart working
- Problems with ChartJS "Uncaught TypeError: Cannot read property 'length' of null"
- Why scatter chart does not show axes?
- Set Chart Background Image - Chart.js
- How to update the chart dynamically with vue-chartjs?
- Uncaught ReferenceError: Chart is not defined in Laravel mix
- Pause chart.js horizontal scroll
- ChartJS and jsPDF - why the background is black?