great programmer
great programmer

Reputation: 179

How to omit decimal values on axis in echart?

Right now my chart had an yAxis with decimal values, but I want only full numbers like 1, 2 or 3

enter image description here

here is my config:

 const option: EChartsOption = {
    dataset: {
      source: data()
    },
    grid: {
      left: "3%",
      right: "4%",
      bottom: "3%",
      containLabel: true
    },
    xAxis: {
      type: "category",
      splitLine: {
        show: true,
        lineStyle: {
          color: "#272A30",
          width: 1
        }
      }
    },
    yAxis: {
      type: "value",
      axisLabel: {
        color: "white",
        fontSize: 11
      },
      splitLine: {
        lineStyle: {
          color: "#272A30",
          width: 1
        }
      }
    },
    series: [
      {
        type: "line",
        smooth: true,
        name: "Incidents",
        showSymbol: false,
        color: "#E24D42",
        symbolSize: 0,
        lineStyle: {
          color: "#E24D42"
        },
        label: {
          precision: 2
        }
      }
    ]
  };

how to omit decimal numbers with using echarts library in react?

Thanks for any help!

Upvotes: 5

Views: 1831

Answers (2)

Mrunal Tupe
Mrunal Tupe

Reputation: 340

yAxis: {
  type: "value",
  minInterval: 1,
}

Upvotes: 1

great programmer
great programmer

Reputation: 179

Ok, I have an answers for the future question and my childs,

yAxis.minInterval: 1

that's all

Upvotes: 4

Related Questions