gpt4 book ai didi

javascript - 在 devextremecharts(dxChart) 中显示系列标签和值

转载 作者:行者123 更新时间:2023-11-28 04:41:24 31 4
gpt4 key购买 nike

我正在使用具有模块化概念的 devextreme 图表(js 图表)。

在我的一个条形图中,我希望显示一个工具提示,它在悬停时显示 SeriesBar 的名称及其所具有的值。IE。让我们假设我的图表有 3 个条形,分别描绘了美国、英国、法国的人口。当我将鼠标悬停在美国(栏)上时,我希望显示我的工具提示

USA:10000

英国和法国也是如此

$("#myChartDiv").dxChart({
dataSource: dataset,
commonSeriesSettings: {
argumentField: 'DimensionValue',
valueField: 'MetricValue',
label: {
visible: true,
format: {
type: "fixedPoint",
precision: Barnumberprecision
}
},
type: 'bar',

},
seriesTemplate: {
nameField: "SurveyYear",

},
valueAxis: {
title: {
text: Title
},
position: "left"
},
argumentAxis: {

label: {
overlappingBehavior: { mode: Barlabeloverlappingmode, rotationAngle: Barlabelrotateangle }
}
},
tooltip: {
enabled: true,
location: "edge",

customizeText: function () {
return this.seriesName;
},
format: {
//type: "fixedPoint",
precision: Barnumberprecision
}
},
legend: {
verticalAlignment: BarlegendverticalAlignment,
horizontalAlignment: BarlegendhorizontalAlignment
}
});

我浏览了 devextreme 网站,但没有找到适合我的属性,或者可能是我没有正确使用它。
有人可以告诉我哪一个属性满足我的要求吗?

最佳答案

我建议您浏览tooltip文档,您将在那里找到可用于显示特定值的属性名称。

请引用此 DX 线程:dxChart - How to customize a tooltip

 tooltip: {
enabled: true,
customizeTooltip: function (point) {
return {
text: point.value+' of '+point.argument+' against '+point.seriesName
}
}
}

关于javascript - 在 devextremecharts(dxChart) 中显示系列标签和值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43735562/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com