Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

设置graphic的type为image,没反应 #18

Open
youngclean opened this issue Mar 21, 2018 · 0 comments
Open

设置graphic的type为image,没反应 #18

youngclean opened this issue Mar 21, 2018 · 0 comments

Comments

@youngclean
Copy link

youngclean commented Mar 21, 2018

Version为1.1.2

依赖的echarts的version为3.8.5

What is expected

在设置option时,设置了graphic,代码如下:

const config = {
  title: { text: "发展趋势", left: "center", textStyle: {
    color: '#4286f4',
    fontSize: 16
  } },
  legend: { bottom: 0, show: true, data: ["身份证数量", "环比增长率"] },
  xAxis: [
    {
      type: "category",
      data: [
        "201701",
        "201702",
        "201703",
        "201704",
        "201705",
        "201706",
        "201707",
        "201708",
        "201709",
        "201710",
        "201711",
        "201712",
        "201801"
      ],
      axisLabel: { interval: 0 },
      axisPointer: { type: "shadow" },
      splitLine:{show: false}
    }
  ],
  yAxis: [
    { type: "value", axisLabel: { formatter: null }  },
    { type: "value", axisLabel: { formatter: "{value}%" }}
  ],
  series: [
    {
      type: "bar",
      name: "身份证数量",
      data: [
        23620000,
        21060000,
        26420000,
        30180000,
        31430000,
        34100000,
        33740000,
        40170000,
        39910000,
        38420000,
        49300000,
        50710000,
        46550000
      ],
      yAxisIndex: 0
    },
    {
      type: "line",
      name: "环比增长率",
      data: [
        -23,
        -12.13,
        20.26,
        12.46,
        4,
        7.82,
        -1.09,
        16.02,
        -0.65,
        -3.88,
        22.05,
        2.79,
        -8.95
      ],
      yAxisIndex: 1
    }
  ],
  graphic: [
    {
      type: 'image',
      id: 'logo',
      style: {
       image: Path.join(__dirname, './default-space-logo-256.png'),
       width: 100,
       height: 100
     }
   }
],
  color: ["#4498f6", "#d9e96c"]
};

node_echarts({
  width: 1000, 
  height: 400, 
  option: config, 
  path: Path.join(__dirname, "./charts.png")
});

本地没有生成charts.png。去掉graphic就成功了

Environment

node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant