0

我已经阅读了 Shield UI 网站上的所有文档,但只能找到与图表工具提示相关的单个语句:

tooltipSettings: {
customHeaderText: "Local point Value: ",
customPointText: function (point, chart) {
                return shield.format(
                    '<span><b>{value}</b></span>',
                    {
                        value: point.y
                    }
                );
            }
},

如果对任何图表进行了更改,则页面上所有图表的工具提示都会更改。

我有一个单选按钮可以在数字和百分比之间切换,因此需要工具提示为该图表包含一个“%”。

有没有人可以在不影响其他图表的情况下更改单个图表的工具提示?

4

1 回答 1

0

我认为这是图表组件中的一个错误,他们已修复它。我使用shieldui 图表 演示网站上最新版本的脚本进行了测试,一切都按预期工作。

您能否尝试使用以下脚本参考,如果问题仍然存在,请告诉我:

<script type="text/javascript" src="http://www.shieldui.com/shared/components/latest/js/shieldui-all.min.js"></script>

我使用以下示例:

<div id="chart1" ></div>
<br /><br /><br /><br /><br /><br />
<div id="chart2"></div>
$(document).ready(function () {
$("#chart2").shieldChart({
    theme: "light",
    exportOptions: {
        image: false,
        print: false
    },

    seriesSettings: {
        bar: {
            stackMode: "normal"
        }
    },
    axisX: {
        categoricalValues: [
            "1952", "1956", "1960", "1964", "1968", "1972", "1976",
            "1984", "1988", "1992", "1996", "2000", "2004", "2008", "2012"
        ]
    },
    primaryHeader: {
        text: "Olympic Medals won by USA"
    },
    dataSeries: [{
        seriesType: "bar",
        collectionAlias: "Gold Medals",
        data: [40, 32, 34, 36, 45, 33, 34, 83, 36, 37, 44, 37, 35, 36, 46],
        stackIndex: 1
    }, {
        seriesType: "bar",
        collectionAlias: "Silver Medals",
        data: [19, 25, 21, 26, 28, 31, 35, 60, 31, 34, 32, 24, 40, 38, 29],
        stackIndex: 1
    }, {
        seriesType: "bar",
        collectionAlias: "Silver Medals1",
        data: [19, 25, 21, 26, 28, 31, 35, 60, 31, 34, 32, 24, 40, 38, 29],
        stackIndex: 2
    },
    {
        seriesType: "bar",
        collectionAlias: "Bronze Medals",
        data: [17, 17, 16, 28, 34, 30, 25, 30, 27, 37, 25, 33, 26, 36, 29],
        stackIndex: 2
    }]
});

$("#chart1").shieldChart({
    theme: "light",
    tooltipSettings: {
        customHeaderText: "Local point Value: ",
        customPointText: function (point, chart) {
            return shield.format(
                '<span><b>{value}</b></span>',
                {
                    value: point.y
                }
            );
        }
    },
    axisX: {
        categoricalValues: [
            "1952", "1956", "1960", "1964", "1968", "1972", "1976",
            "1984", "1988", "1992", "1996", "2000", "2004", "2008", "2012"
        ]
    },
    primaryHeader: {
        text: "Olympic Medals won by USA"
    },
    dataSeries: [{
        seriesType: "bar",
        collectionAlias: "Gold Medals",
        data: [40, 32, 34, 36, 45, 33, 34, 83, 36, 37, 44, 37, 35, 36, 46],
    }]
});});
于 2015-05-25T18:30:36.243 回答