在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ 關(guān)于echarts一個(gè)餅圖案例的問題

關(guān)于echarts一個(gè)餅圖案例的問題

http://gallery.echartsjs.com/...

請問下有人知道怎么把這echarts里的6個(gè)餅圖放一行嗎

回答
編輯回答
怣人

先看下文檔吧
radius代表半徑
center代表中心坐標(biāo)點(diǎn)
我隨便改了下實(shí)現(xiàn)了6個(gè)在一行,具體的你看完文檔再自己探索

pieFormat=function (obj) {
    if(obj.name=="別人家的孩子"){
         return obj.seriesName+":"+(obj.percent)+"%";
    }
    return obj.name+":"+(obj.percent)+"%";
};

formatValue=function (obj) {
    return formatNumber(obj.value);
};

formatNameValue=function (obj) {
    return obj.name+":"+formatNumber(obj.value);
};


userFormFormat=function (obj) {
    if(obj.name=="干兒子"||obj.name=="親兒子"){
         return obj.seriesName+":"+(obj.percent)+"%";
    }
    return (obj.percent)+"%";
};


formatNumber=function(n){
   var b=parseInt(n).toString();
   var len=b.length;
   if(len<=3){return b;}
   var r=len%3;
   return r>0?b.slice(0,r)+","+b.slice(r,len).match(/\d{3}/g).join(","):b.slice(r,len).match(/\d{3}/g).join(",");
};

option ={
  "title" : {
    "text" : "\n67373觀眾來源:20170212-20170218"
  },
  "legend" : {
    "data" : [ "親兒子", "干兒子", "別人家的孩子", null, null, null, null, null, null, null, null, null, null, null, null ]
  },
  "series" : [ {
    "color" : [ "#86D560", "#AF89D6", "#59ADF3", "#FF999A", "#FFCC67" ],
    "name" : "女流66",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "9297"
    }, {
      "name" : "別人家的孩子",
      "value" : "53057"
    }, {
      "name" : "親兒子",
      "value" : "119032"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : pieFormat,
        "textStyle" : { }
      }
    },
    "radius" : "10%",
    "center" : [ "10%", "30%" ]
  }, {
    "name" : "",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "9297"
    }, {
      "name" : "別人家的孩子",
      "value" : "53057"
    }, {
      "name" : "親兒子",
      "value" : "119032"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : formatValue,
        "textStyle" : {
          "fontSize" : 14,
          "color" : "#777777"
        }
      }
    },
    "radius" : [ "10%", "20%" ],
    "center" : [ "10%", "30%" ],
    "itemStyle" : {
      "normal" : {
        "color" : "#F2F2F2"
      },
      "emphasis" : {
        "color" : "#ADADAD"
      }
    }
  }, {
    "color" : [ "#86D560", "#AF89D6", "#59ADF3", "#FF999A", "#FFCC67" ],
    "name" : "馮提莫",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "8814"
    }, {
      "name" : "別人家的孩子",
      "value" : "113171"
    }, {
      "name" : "親兒子",
      "value" : "119515"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : pieFormat,
        "textStyle" : { }
      }
    },
    "radius" : "10%",
    "center" : [ "25%", "30%" ]
  }, {
    "name" : "",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "8814"
    }, {
      "name" : "別人家的孩子",
      "value" : "113171"
    }, {
      "name" : "親兒子",
      "value" : "119515"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : formatValue,
        "textStyle" : {
          "fontSize" : 14,
          "color" : "#777777"
        }
      }
    },
    "radius" : [ "10%", "20%" ],
    "center" : [ "25%", "30%" ],
    "itemStyle" : {
      "normal" : {
        "color" : "#F2F2F2"
      },
      "emphasis" : {
        "color" : "#ADADAD"
      }
    }
  }, {
    "color" : [ "#86D560", "#AF89D6", "#59ADF3", "#FF999A", "#FFCC67" ],
    "name" : "劉飛兒faye",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "4460"
    }, {
      "name" : "別人家的孩子",
      "value" : "44476"
    }, {
      "name" : "親兒子",
      "value" : "123869"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : pieFormat,
        "textStyle" : { }
      }
    },
    "radius" : "10%",
    "center" : [ "40%", "30%" ]
  }, {
    "name" : "",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "4460"
    }, {
      "name" : "別人家的孩子",
      "value" : "44476"
    }, {
      "name" : "親兒子",
      "value" : "123869"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : formatValue,
        "textStyle" : {
          "fontSize" : 14,
          "color" : "#777777"
        }
      }
    },
    "radius" : [ "10%", "20%" ],
    "center" : [ "40%", "30%" ],
    "itemStyle" : {
      "normal" : {
        "color" : "#F2F2F2"
      },
      "emphasis" : {
        "color" : "#ADADAD"
      }
    }
  }, {
    "color" : [ "#86D560", "#AF89D6", "#59ADF3", "#FF999A", "#FFCC67" ],
    "name" : "趙小臭",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "3061"
    }, {
      "name" : "別人家的孩子",
      "value" : "29294"
    }, {
      "name" : "親兒子",
      "value" : "125268"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : pieFormat,
        "textStyle" : { }
      }
    },
    "radius" : "10%",
    "center" : [ "55%", "30%" ]
  }, {
    "name" : "",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "3061"
    }, {
      "name" : "別人家的孩子",
      "value" : "29294"
    }, {
      "name" : "親兒子",
      "value" : "125268"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : formatValue,
        "textStyle" : {
          "fontSize" : 14,
          "color" : "#777777"
        }
      }
    },
    "radius" : [ "10%", "20%" ],
    "center" : [ "55%", "30%" ],
    "itemStyle" : {
      "normal" : {
        "color" : "#F2F2F2"
      },
      "emphasis" : {
        "color" : "#ADADAD"
      }
    }
  }, {
    "color" : [ "#86D560", "#AF89D6", "#59ADF3", "#FF999A", "#FFCC67" ],
    "name" : "萌面酥",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "2064"
    }, {
      "name" : "別人家的孩子",
      "value" : "45268"
    }, {
      "name" : "親兒子",
      "value" : "126265"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : pieFormat,
        "textStyle" : { }
      }
    },
    "radius" : "10%",
    "center" : [ "70%", "30%" ]
  }, {
    "name" : "",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "2064"
    }, {
      "name" : "別人家的孩子",
      "value" : "45268"
    }, {
      "name" : "親兒子",
      "value" : "126265"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : formatValue,
        "textStyle" : {
          "fontSize" : 14,
          "color" : "#777777"
        }
      }
    },
    "radius" : [ "10%", "20%" ],
    "center" : [ "70%", "30%" ],
    "itemStyle" : {
      "normal" : {
        "color" : "#F2F2F2"
      },
      "emphasis" : {
        "color" : "#ADADAD"
      }
    }
  }, {
    "color" : [ "#86D560", "#AF89D6", "#59ADF3", "#FF999A", "#FFCC67" ],
    "name" : "丸子喲",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "1790"
    }, {
      "name" : "別人家的孩子",
      "value" : "29243"
    }, {
      "name" : "親兒子",
      "value" : "126539"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : pieFormat,
        "textStyle" : { }
      }
    },
    "radius" : "10%",
    "center" : [ "85%", "30%" ]
  }, {
    "name" : "",
    "type" : "pie",
    "data" : [ {
      "name" : "干兒子",
      "value" : "1790"
    }, {
      "name" : "別人家的孩子",
      "value" : "29243"
    }, {
      "name" : "親兒子",
      "value" : "126539"
    } ],
    "label" : {
      "normal" : {
        "position" : "inner",
        "formatter" : formatValue,
        "textStyle" : {
          "fontSize" : 14,
          "color" : "#777777"
        }
      }
    },
    "radius" : [ "10%", "20%" ],
    "center" : [ "85%", "30%" ],
    "itemStyle" : {
      "normal" : {
        "color" : "#F2F2F2"
      },
      "emphasis" : {
        "color" : "#ADADAD"
      }
    }
  } ],
  "tooltip" : {
    "trigger" : ""
  },
  "toolbox" : { },
  "color" : [ "#c23531", "#2f4554", "#61a0a8", "#d48265", "#91c7ae", "#749f83", "#ca8622", "#bda29a", "#6e7074", "#546570", "#c4ccd3" ]
}
2017年3月24日 07:30
編輯回答
情皺

這個(gè)問題我先在群里問到了,第一種解決方案就是調(diào)center的值,還有一種就是做六個(gè)div,一個(gè)div對應(yīng)一個(gè)餅圖,個(gè)人覺得第二種更靈活,但是還沒實(shí)現(xiàn)的思路

2017年11月20日 14:04
編輯回答
浪婳

通過修改option的配置項(xiàng)的參數(shù):如下
圖片描述
圖片描述
改變他們的半徑和中心點(diǎn)的位置可以實(shí)現(xiàn)你想要的布局!

2017年3月29日 21:41