option3.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. function option3 (name) {
  2. var option = {
  3. title : {
  4. text: 'GDP',
  5. subtext: '数据来自国家统计局',
  6. x:'right',
  7. textStyle:{}
  8. },
  9. tooltip : {
  10. trigger: 'item'
  11. },
  12. dataRange: {
  13. min: 0,
  14. max : dataMap['dataA' + name][2011 + 'max'],
  15. text:['高','低'], // 文本,默认为数值文本
  16. calculable : true,
  17. x: 'left'
  18. },
  19. series : [
  20. {
  21. type: 'map',
  22. mapType: 'china',
  23. mapLocation: {
  24. y: 'top',
  25. height : 340
  26. },
  27. itemStyle:{
  28. normal:{label:{show:true}}
  29. }
  30. }
  31. ]
  32. };
  33. option.title.text = '人均' + eNameMap[name];
  34. var color = eColorMap[name];
  35. option.title.textStyle.color = color;
  36. option.dataRange.color = [
  37. color,
  38. require('zrender/tool/color').lift(color, -0.9)
  39. ];
  40. // console.log(option.dataRange.color,name)
  41. var timelineOption = {
  42. timeline : {
  43. data : (function(){
  44. var a = [];
  45. for (var i = 2002; i <= 2011; i++) {
  46. a.push(i + '-01-01');
  47. }
  48. return a;
  49. })(),
  50. label : {
  51. formatter : function(s) {
  52. return s.slice(0, 4);
  53. }
  54. },
  55. playInterval : 1000
  56. },
  57. options : []
  58. };
  59. var curYear = 2002;
  60. option.series[0].name = '人均' + eNameMap[name] + '(' + curYear + ')';
  61. option.series[0].data = dataMap['dataA' + name][curYear]
  62. timelineOption.options.push(option);
  63. for (curYear = 2003; curYear <= 2011; curYear++) {
  64. var newSeries = {
  65. type: 'map',
  66. mapType: 'china',
  67. itemStyle:{
  68. normal:{label:{show:true}}
  69. }
  70. };
  71. newSeries.name = '人均' + eNameMap[name] + '(' + curYear + ')';
  72. newSeries.data = dataMap['dataA' + name][curYear]
  73. timelineOption.options.push({
  74. series : [newSeries]
  75. })
  76. }
  77. return timelineOption;
  78. }