Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Echarts pie with dataset

I want draw a pie like this, and I want to store data in dataset:

option = {
  dataset: {
    dimensions: ['a', 'b'],
    source: { a: 85, b: 79 }
  },
  series: [
    {
      name: 'template',
      type: 'pie',
      // get data from dataset
    }
  ]
};

source is an object, so I can just reset the dataset when source was changed and dont need to do likeoption.series[0].data[0].value = ... for every value.

I was try to set encode.value = ['a', 'b'] or some other settings but it was not work. How can I do for this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The source format of your dataset should be one of these 3 formats :

source: [
  {name: 'a', value: 85},
  {name: 'b', value: 79},
]
source: [
  ['name', 'value'],
  ['a', 85],
  ['b',79]
]
source: {
  'name': ['a', 'b'],
  'value': [85, 79],
}

For example :

var myChart = echarts.init(document.getElementById('main'));

option = {
  dataset: {
    source: [
      {name: 'a', value: 85},
      {name: 'b', value: 79},
    ]
  },
  series: [
    {
      name: 'template',
      type: 'pie',
    }
  ]
};

myChart .setOption(option)
<html>
  <body>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.3.2/echarts.min.js"></script>
    <div id="main" style="width: 600px; height:400px;"></div>
  </body>
</html>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!