@@ -424,7 +424,7 @@ describe('leaflet_GraphThemeLayer', function () {
424424 } ) ;
425425
426426 //在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,返回此 feature
427- it ( 'getFeatureBy' , function ( ) {
427+ xit ( 'getFeatureBy' , function ( ) {
428428 var graphThemeLayer = L . supermap . graphThemeLayer ( "BarThemeLayer" , "Bar" ) . addTo ( map ) ;
429429 graphThemeLayer . themeFields = [ "CON2009" , "CON2010" , "CON2011" , "CON2012" , "CON2013" ] ;
430430 graphThemeLayer . chartsSetting = {
@@ -466,48 +466,48 @@ describe('leaflet_GraphThemeLayer', function () {
466466 graphThemeLayer . clear ( ) ;
467467 } ) ;
468468
469- // //通过给定一个 id,返回对应的矢量要素
470- // it ('getFeatureById', function () {
471- // var graphThemeLayer = L.supermap.graphThemeLayer("BarThemeLayer", "Bar").addTo(map);
472- // graphThemeLayer.themeFields = ["CON2009", "CON2010", "CON2011", "CON2012", "CON2013"];
473- // graphThemeLayer.chartsSetting = {
474- // width: 240,
475- // height: 100,
476- // codomain: [0, 40000],
477- // barStyle: {fillOpacity: 0.7},
478- // barHoverStyle: {fillOpacity: 1},
479- // xShapeBlank: [10, 10, 10],
480- // axisYTick: 4,
481- // axisYLabels: ["4万", "3万", "2万", "1万", "0"],
482- // axisXLabels: ["09年", "10年", "11年", "12年", "13年"],
483- // backgroundStyle: {fillColor: "#CCE8CF"},
484- // backgroundRadius: [5, 5, 5, 5],
485- // showShadow: true,
486- // barShadowStyle: {shadowBlur: 8, shadowOffsetX: 2, shadowOffsetY: 2, shadowColor: "rgba(100,100,100,0.8)"},
487- // barLinearGradient: [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]]
488- // };
489- // expect(graphThemeLayer.features.length).toEqual(0);
490- // var features = [];
491- // for (var i = 0, len = chinaConsumptionLevel.length; i < len; i++) {
492- // var provinceInfo = chinaConsumptionLevel[i];
493- // var geometry = L.point(provinceInfo[1], provinceInfo[2]);
494- // var atrributes = {};
495- // atrributes.NAME = provinceInfo[0];
496- // atrributes.CON2009 = provinceInfo[3];
497- // atrributes.CON2010 = provinceInfo[4];
498- // atrributes.CON2011 = provinceInfo[5];
499- // atrributes.CON2012 = provinceInfo[6];
500- // atrributes.CON2013 = provinceInfo[7];
501- // var fea = L.supermap.themeFeature(geometry, atrributes);
502- // features.push(fea);
503- // }
504- // graphThemeLayer.addFeatures(features);
505- // var result = graphThemeLayer.getFeatureById("SuperMap.Feature_4360");
506- // expect(result).not.toBeNull();
507- // expect(result.id).toEqual("SuperMap.Feature_4360");
508- // expect(result.attributes.NAME).toEqual("北京市");
509- // graphThemeLayer.clear();
510- // });
469+ //通过给定一个 id,返回对应的矢量要素
470+ xit ( 'getFeatureById' , function ( ) {
471+ var graphThemeLayer = L . supermap . graphThemeLayer ( "BarThemeLayer" , "Bar" ) . addTo ( map ) ;
472+ graphThemeLayer . themeFields = [ "CON2009" , "CON2010" , "CON2011" , "CON2012" , "CON2013" ] ;
473+ graphThemeLayer . chartsSetting = {
474+ width : 240 ,
475+ height : 100 ,
476+ codomain : [ 0 , 40000 ] ,
477+ barStyle : { fillOpacity : 0.7 } ,
478+ barHoverStyle : { fillOpacity : 1 } ,
479+ xShapeBlank : [ 10 , 10 , 10 ] ,
480+ axisYTick : 4 ,
481+ axisYLabels : [ "4万" , "3万" , "2万" , "1万" , "0" ] ,
482+ axisXLabels : [ "09年" , "10年" , "11年" , "12年" , "13年" ] ,
483+ backgroundStyle : { fillColor : "#CCE8CF" } ,
484+ backgroundRadius : [ 5 , 5 , 5 , 5 ] ,
485+ showShadow : true ,
486+ barShadowStyle : { shadowBlur : 8 , shadowOffsetX : 2 , shadowOffsetY : 2 , shadowColor : "rgba(100,100,100,0.8)" } ,
487+ barLinearGradient : [ [ "#00FF00" , "#00CD00" ] , [ "#00CCFF" , "#5E87A2" ] , [ "#00FF66" , "#669985" ] , [ "#CCFF00" , "#94A25E" ] , [ "#FF9900" , "#A2945E" ] ]
488+ } ;
489+ expect ( graphThemeLayer . features . length ) . toEqual ( 0 ) ;
490+ var features = [ ] ;
491+ for ( var i = 0 , len = chinaConsumptionLevel . length ; i < len ; i ++ ) {
492+ var provinceInfo = chinaConsumptionLevel [ i ] ;
493+ var geometry = L . point ( provinceInfo [ 1 ] , provinceInfo [ 2 ] ) ;
494+ var atrributes = { } ;
495+ atrributes . NAME = provinceInfo [ 0 ] ;
496+ atrributes . CON2009 = provinceInfo [ 3 ] ;
497+ atrributes . CON2010 = provinceInfo [ 4 ] ;
498+ atrributes . CON2011 = provinceInfo [ 5 ] ;
499+ atrributes . CON2012 = provinceInfo [ 6 ] ;
500+ atrributes . CON2013 = provinceInfo [ 7 ] ;
501+ var fea = L . supermap . themeFeature ( geometry , atrributes ) ;
502+ features . push ( fea ) ;
503+ }
504+ graphThemeLayer . addFeatures ( features ) ;
505+ var result = graphThemeLayer . getFeatureById ( "SuperMap.Feature_4360" ) ;
506+ expect ( result ) . not . toBeNull ( ) ;
507+ expect ( result . id ) . toEqual ( "SuperMap.Feature_4360" ) ;
508+ expect ( result . attributes . NAME ) . toEqual ( "北京市" ) ;
509+ graphThemeLayer . clear ( ) ;
510+ } ) ;
511511
512512 // 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
513513 it ( 'getFeaturesByAttribute' , function ( ) {
0 commit comments