如何从Highchart获取元素属性

时间:2015-10-06 05:12:06

标签: javascript jquery svg highcharts

function MyCtrl($scope, limitToFilter) {
Highcharts.setOptions({
     colors: ['#B1D08C', '#B1D08C', '#B1D08C']
    });

$scope.ideas = [
    ['Development', 70],
    ['Exploration', 5],
    ['Other', 10],
    ['ideas4', 5]
  ];


$scope.limitedIdeas = limitToFilter($scope.ideas, 3);

}

angular.module('myApp', [])
  .directive('hcPie', function () {
  return {
    restrict: 'C',
    replace: true,
    scope: {
      items: '='
    },
controller: function ($scope, $element, $attrs) {
      console.log(4);

    },
template: '<div id="container" style="margin: 0 auto">not working</div>',
    link: function (scope, element, attrs) {
      console.log(3);
var chart = new Highcharts.Chart({


 subtitle: {
            text: '$2567 mm',
            align: 'center',
            verticalAlign: 'middle',
            y: 40,
            useHTML: true
        },

chart: {
          renderTo: 'container',
          plotBackgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false,           
          type: 'pie'
        },
        title: {
          text: 'CAPITAL (DEVON) E&P CAPEX'
        },
        tooltip: {
          //pointFormat: '{series.name}: <b>{point.percentage}</b>',
          //percentageDecimals: 1
        },

plotOptions: {
        pie: {
                borderColor: '#fff',
                innerSize: '60%',

            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
              enabled: true,
              color: '#000000',
              connectorColor: '#000',
              /*formatter: function () {
                return '<b>' + this.point.name + '</b>: ' + this.percentage;
              }*/
            }
}
},

series: [{
          type: 'pie',
          name: 'Browser share',
          data: scope.items
        }]
      });


scope.$watch("items", function (newValue) {
        chart.series[0].setData(newValue, true);
      }, true);

    }
  }

});

我正在尝试创建一个带圆圈的数据图表。在图表中心创建圆圈有什么选择吗?如何通过jquery

获取高级SVG元素(如<g class="highcharts-series-group">)的属性(位置或宽度)

https://jsfiddle.net/id10922606/81cwutyf/1/

1 个答案:

答案 0 :(得分:0)

这个问题:

import urllib2
from bs4 import BeautifulSoup as bs4

list = ["aapl","goog"]
i = 0
while i < len(list):
       url = urllib2.urlopen("http://finance.yahoo.com/q?s="+ list[i] +"&q1=1")
       soup = bs4(url,"html.parser")
       for price in soup.find(attrs={'id':"yfs_l84_" + list[i]}):
           print "something"
           i += 1
           if price > 50:
               print price

请参阅fiddle here