简体   繁体   中英

Can Shield UI Chart Tooltip be different for multiple Charts on the same Page?

I have read through all the Documentation on the Shield UI website, but could only find a single statement related to the Chart Tooltip:

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

If this is changed for any Chart, the Tooltips for all Charts on the Page changes.

I have a radio button to switch between Number and Percentage and so need the Tooltip to include a '%' just for that Chart.

Does anyone have a way to change the Tooltip for a Single Chart without affecting the others?

I think that this was a bug in the chart component and they are fixed it. I tested with the latest version of the scripts from the shieldui chart demos' web site and everything works as expected.

Can you try using following script reference and let me know if the issue still persists:

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

I use following example:

<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],
    }]
});});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM