Jquery 如何在gebo饼图中显示数据值而不是百分比?

Jquery 如何在gebo饼图中显示数据值而不是百分比?,jquery,charts,tooltip,pie-chart,Jquery,Charts,Tooltip,Pie Chart,以上是gebo admin Charts和j query的函数 现在我想要的是在饼图的工具提示中显示数据值,而不是百分比。我看了很多。但什么都找不到。有人能给我指点一下吗 下面的代码来自上面的函数,它设置了百分比,但我只想使用数据,而不是它的百分比 $.plot(elem, data, { // // series : { pie : {

以上是gebo admin Charts和j query的函数

现在我想要的是在饼图的工具提示中显示数据值,而不是百分比。我看了很多。但什么都找不到。有人能给我指点一下吗

下面的代码来自上面的函数,它设置了百分比,但我只想使用数据,而不是它的百分比

$.plot(elem, data, {
//
                        //
                        series : {
                            pie : {
                                show : true,
                                highlight : {
                                    opacity : 0.2
                                }
                            }
                        },
                        grid : {
                            hoverable : true,
                            clickable : true
                        },
                        colors : [ "#245779", "#85c441", "#e88b2f", "#bb43f2",
                                "#3073a0", "#9C2323", "#183b52", "#8cc7e0",
                                "#64b4d5", "#3ca0ca", "#2d83a6", "#22637e",
                                "#174356", "#0c242e" ]
                    // colors: [ "#b4dbeb", "#8cc7e0", "#64b4d5", "#3ca0ca",
                    // "#2d83a6", "#22637e", "#174356", "#0c242e" ]
                    });
                    // Create a tooltip on our chart
                    elem.qtip({
                        prerender : true,
                        content : 'Loading...', // Use a loading message
                        // primarily
                        position : {
                            viewport : $(window), // Keep it visible within
                            // the window if possible
                            target : 'mouse', // Position it in relation to
                            // the mouse
                            adjust : {
                                x : 7
                            }
                        // ...but adjust it a bit so it doesn't overlap it.
                        },
                        show : true, // We'll show it programatically, so no
                        // show event is needed
                        style : {
                            classes : 'ui-tooltip-shadow ui-tooltip-tipsy',
                            tip : false
                        // Remove the default tip.
                        }
                    });

                    // Bind the plot hover
                    elem
                            .on(
                                    'plothover',
                                    function(event, pos, obj) {

                                        // Grab the API reference
                                        var self = $(this), api = $(this)
                                                .qtip(), previousPoint, content,

                                        // Setup a visually pleasing rounding
                                        // function
                                        round = function(x) {
                                            return Math.round(x * 1000) / 1000;
                                        };

                                        // If we weren't passed the item object,
                                        // hide the tooltip and remove cached
                                        // point data
                                        if (!obj) {
                                            api.cache.point = false;
                                            return api.hide(event);
                                        }

                                        // Proceed only if the data point has
                                        // changed
                                        previousPoint = api.cache.point;
                                        if (previousPoint !== obj.seriesIndex) {
                                            percent = parseFloat(
                                                    obj.series.percent)
                                                    .toFixed(2);
                                            // Update the cached point data
                                            api.cache.point = obj.seriesIndex;
                                            // Setup new content
                                            content = obj.series.label + ' ( '
                                                    + percent + '% )';
                                            alert(content);
                                            // Update the tooltip content
                                            api.set('content.text', content);
                                            // Make sure we don't get problems
                                            // with animations
                                            // api.elements.tooltip.stop(1, 1);
                                            // Show the tooltip, passing the
                                            // coordinates
                                            api.show(pos);
                                        }
                                    });

                }
            });

好的,就这样了。我在谷歌搜索了太多之后成功了

(previousPoint !== obj.seriesIndex) {
                                                percent = parseFloat(
                                                        obj.series.percent)
                                                        .toFixed(2);
                                                // Update the cached point data
                                                api.cache.point = obj.seriesIndex;
                                                // Setup new content
                                                content = obj.series.label + ' ( '
                                                        + percent + '% )';
                                                alert(content);
                                                // Update the tooltip content
                                                api.set('content.text', content);

if (previousPoint !== obj.seriesIndex) {
                                            percent = parseFloat(
                                                    obj.series.percent)
                                                    .toFixed(2);
                                            // Update the cached point data
                                            api.cache.point = obj.seriesIndex;
                                            // Setup new content
                                            content = obj.series.label + ' ('
                                            + obj.series.data[0][1] + ')';

                                            // Update the tooltip content
                                            api.set('content.text', content);
                                            // Make sure we don't get problems
                                            // with animations
                                            // api.elements.tooltip.stop(1, 1);
                                            // Show the tooltip, passing the
                                            // coordinates
                                            api.show(pos);
                                        }
obj.series.data[0][1]为我提供了数据点的值,而不是百分比

content = obj.series.label + ' ('
                                            + obj.series.data[0][1] + ')';