Topic: Using modules/charts.min.js without mdb.min.js
My question: I like to use different kind of charts. The problem is when I do my referencing on mdb.min.js
it ist possible to create new.mdb
object but the behaviour of my other bootstrap 5.2 elemenets (e.g. buttons) are going mad. Means that they expand on click for instance. So I tried to do my referencing only with charts.min.js
. But in this way I don't see the chart inside my html page. Only by using jquery the charts is still visible. But by by using only jquery I can't initialize the second parameter inside the constructor
$('#test').chart(dataChartDoubleYAxisExample, optionsChartDoubleYAxisExample);
in case of moving the displayed scale on one the left and the other to the right
starting options:
const optionsChartDoubleYAxisExample = {
options: {
scales: {
y: {
display: true,
position: 'left',
},
y1: {
display: true,
position: 'right',
grid: {
drawOnChartArea: false,
},
ticks: {
beginAtZero: true,
},
},
},
},
};
Do you have any advice for fixing this issue ?
Grzegorz Bujański staff answered 2 years ago
It seems we have a bug and using jQ it is not possible to pass options correctly. We will check it and fix it.
For now, use JS. In your case, it looks like you initialized the component incorrectly. If you are using the mdb.min.js
file, you can actually use the mdb
object and the init looks like this:
new mdb.Chart(element, dataBar);
But if you only import charts.min.js
init looks like this:
new charts(element, dataBar);
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.0.1
- Device: workstation
- Browser: Mozilla Firefox
- OS: Linux on VMware
- Provided sample code: No
- Provided link: No