Skip to content

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

@youngclean

Description

@youngclean

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions