jeredmasters / chartjs-subtitle Goto Github PK
View Code? Open in Web Editor NEWAdd a subtitle to ChartJS
License: MIT License
Add a subtitle to ChartJS
License: MIT License
I've added the code in the readme to the plugins section, changed the display value to true
and added my string to the text variable. However, a subtitle isn't generated. I don't get any errors in the console so I don't understand what is going on. Do I have to register it globally?
If I add Chart.plugins.register(chartJsPluginSubtitle)
I get an error in the console: Uncaught ReferenceError: chartJsPluginSubtitle is not defined
.
Hi, I've installed this plugin with npm, but I'm not able to import it with Webpack.
What have I'm supposed to write? I've written the following combinations without success:
import 'customjs-subtitle';
import SubtitlePlugin from 'customjs-subtitle';
import 'customjs-subtitle/build/Plugin.Subtitle.js';
import SubtitlePlugin from 'customjs-subtitle/build/Plugin.Subtitle.js';
import 'customjs-subtitle/src/plugin.js';
import SubtitlePlugin from 'customjs-subtitle/src/plugin.js';
My file, where chart.js works, is the following
import Chart from 'chart.js/dist/Chart';
import 'chartjs-subtitle'; // or another import from the list above...
export default class MyChart {
constructor(data) {
this.context = document.getElementById(canvasId).getContext('2d');
}
createChart() {
new Chart(this.context, {
type: 'bar',
data: this.data,
options: {
title: {
display: true,
text: 'Chart Title,
},
plugins: {
chartJsPluginSubtitle: {
display: true,
text: 'Subtitle',
},
},
},
});
} // createChart()
} //MyChart()
What I'm missing?
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.