2013-03-23 127 views
0
$.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); 
             } 
            }); 

       } 
      }); 

以上是从其中j查询格博管理图表功能如何在gebo饼图中显示数据值而不是百分比?

现在我想的是,以显示数据值而不是馅饼Chart..i的刀尖的百分比都瞪大眼睛一个lot..but找不到任何东西......任何人都可以引导我?

以下从上面这些设置百分比功能代码,但我希望只使用data..rather那么它的个...

(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); 

回答

0

好,,这goes..i后太成功谷歌搜索..

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

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

obj.series.data [0] [1]给我数据点的值而不是百分比

相关问题