v3.1.2
VueUiDashboard improvements #246
- Add user options in config, with optional annotator; image and pdf
const config = ref({
userOptions: {
show: true,
showOnChartHover: false,
keepStateOnChartLeave: true,
position: 'right',
buttons: {
pdf: true,
img: true,
annotator: true
},
callbacks: {
pdf: null,
img: null,
annotator: null
},
buttonTitles: {
pdf: 'Download PDF',
img: 'Download PNG',
annotator: 'Toggle annotator'
},
print: {
scale: 2,
filename: ''
}
}
})User options callbacks:
const config = ref({
userOptions: {
// These callbacks will be called when user options buttons are clicked.
callbacks: {
pdf: (chart: HTMLElement) => {
// use your own pdf solution
},
img: (base64: string) => {
// do whatever you want with the base 64 image data of the chart
},
// all other buttons have also their callbacks (no params), with the same name as the button
}
}
})PDF improvements
- The size of the PDF is based on
config.style.board.aspectRatio(default: "1/1.4141", which is A4 in portrait mode) - The file name can be set in
config.userOptions.print.filename
Deprecated config options
config.allowPrintis deprecated, but will still keep working. It is replaced withconfig.userOptions.show. It is recommended to make the change.config.style.resizeHandles.borderis removed (was not applied anyway, so no breaking change here either)