Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery flot图表带百分比的实际数据_Jquery_Charts - Fatal编程技术网

Jquery flot图表带百分比的实际数据

Jquery flot图表带百分比的实际数据,jquery,charts,Jquery,Charts,我不熟悉flot图表和javascript/jquery,所以我不太清楚这些东西是如何工作的。如何以“数据:百分比”样式的格式显示标签 我从SO获得了百分比代码: pie: { show: true, label: { show: true, // Added custom formatter here... formatter: function(label,point){

我不熟悉flot图表和javascript/jquery,所以我不太清楚这些东西是如何工作的。如何以“数据:百分比”样式的格式显示标签

我从SO获得了百分比代码:

pie: {
         show: true,
         label: {
             show: true,
             // Added custom formatter here...
             formatter: function(label,point){
                 return(point.percent.toFixed(2) + '%');
             }
         }
    }
label: {
                show: true,
                radius: 2 / 3,
                formatter: function (label, series) {
                    return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + series.data[0][1] + '</div>';
                },
                threshold: 0.1
            }
以及来自SO的数据代码:

pie: {
         show: true,
         label: {
             show: true,
             // Added custom formatter here...
             formatter: function(label,point){
                 return(point.percent.toFixed(2) + '%');
             }
         }
    }
label: {
                show: true,
                radius: 2 / 3,
                formatter: function (label, series) {
                    return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">' + label + '<br/>' + series.data[0][1] + '</div>';
                },
                threshold: 0.1
            }
标签:{
秀:没错,
半径:2/3,
格式化程序:函数(标签,系列){
返回'+label+'
'+series.data[0][1]+''; }, 阈值:0.1 }
自己解决问题:

formatter: function (label, series) {
                            return "<div style='font-size:15pt;'>" + label + "<br>" + series.data[0][1] + " : " + series.percent.toFixed(2) + "%" + "</div>";
                        }
格式化程序:函数(标签,系列){
返回“+label+”
“+series.data[0][1]+”:“+series.percent.toFixed(2)+”%“+”; }
代码有什么问题吗?我想将这两个以“data:%”格式显示的代码组合起来……但我不知道如何使用..您知道如何使用
jsfiddle.net
如果您展示您当前正在做的事情,这将非常有帮助。只需写一个简短的示例说明您是如何使用它的。我对jsfiddle.net也很陌生……我在中发布了我的代码,但我不知道如何添加我的js图表文件