Hi,
I understand that vue-chart supports option[“dataView”].optionToContent But it is a callback function. How do I configure this in YAML so that the DataView follows the customized format?
Hi,
I understand that vue-chart supports option[“dataView”].optionToContent But it is a callback function. How do I configure this in YAML so that the DataView follows the customized format?
Thanks @JustinG . I should be more specific. When we enable " Data View" on Chart toolbox features, the format of the data view is a default one though it be customised with OptionToContent callback property. I would like to customize the DataView table format. I looked through the code below oh-chart-toolbox.ts and there is no obvious way to reformat the DataView content?
const presetFeatures = {
saveAsImage: { title: 'Save as Image' },
restore: { title: 'Restore' },
dataView: { title: 'Data Table', lang: ['Data Table', 'Close', 'Refresh'] },
dataZoom: { title: { zoom: 'Area Zooming', back: 'Restore Area Zoom' } },
magicType: { title: { line: 'Line', bar: 'Bar', stack: 'Stack', tiled: 'Tiled' }, type: ['line', 'bar', 'stack', 'tiled'] }
}
const chartToolbox: MiscChartComponent = {
get(context, component) {
const options = context.evaluateExpression<OhChartToolbox.Config & ToolboxComponentOption>(
ComponentId.get(component)!,
component.config as unknown as OhChartToolbox.Config & ToolboxComponentOption,
OhChartToolboxDefinition
)
if (options.presetFeatures && !options.feature) {
options.feature = Object.assign({}, presetFeatures) as ToolboxComponentOption['feature']
for (const featureName in options.feature) {
options.feature[featureName]!.show = options.presetFeatures.indexOf(featureName) >= 0
}
}
if (!options.left) options.left = 'center'
return options
}
}
I see. Yes, I think you are correct, the toolbox appears to only permit selection of the presets, not arbitrary configuration.