【问题标题】:Display both the series label and the value in a devextremecharts(dxChart)在 devextremecharts(dxChart) 中显示系列标签和值
【发布时间】:2017-05-02 10:24:16
【问题描述】:

我正在使用具有模块化概念的 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 网站,但没有找到适合我的财产,或者可能是我没有正确使用它。
谁能告诉我哪个属性满足我的要求?

【问题讨论】:

    标签: javascript jquery devexpress devextreme


    【解决方案1】:

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

    参考这个 DX 线程:dxChart - How to customize a tooltip

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-19
      • 1970-01-01
      相关资源
      最近更新 更多