Ovilia opened a new pull request, #20226:
URL: https://github.com/apache/echarts/pull/20226

   <!-- Please fill in the following information to help us review your PR more 
efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [x] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   Custom series provide a powerful way to let developers define their own 
charts. But for now, it's hard to reuse the `renderItem` for other projects or 
other developers. This PR provides a way to register custom series so that 
developer A can make a custom series and publish it (probably by npm) and 
developer B can use it by simply setting `series.type` to the related name.
   
   ### Fixed issues
   
   <!--
   - #xxxx: ...
   -->
   
   
   ## Details
   
   ### Before: What was the problem?
   
   Custom series is hard to be reused.
   
   ### After: How does it behave after the fixing?
   
   #### Making a reusable custom series:
   
   ```ts
   const renderItem = (params, api) => {
       return {
           type: 'circle',
           shape: {
               cx: api.coord([api.value(0), api.value(1)])[0],
               cy: api.coord([api.value(0), api.value(1)])[1],
               r: api.value(2)
           },
           style: {
               fill: api.visual('color')
           }
       }
   };
   echarts.registerCustomSeries('bubble', renderItem);
   ```
   
   #### Using the above custom series:
   
   ```ts
   const option = {
       xAxis: {},
       yAxis: {},
       series: {
           type: 'custom.bubble',
           data: [[11, 22, 20], [33, 44, 40]]
       }
   };
   ```
   
   ## Document Info
   
   One of the following should be checked.
   
   - [ ] This PR doesn't relate to document changes
   - [x] The document should be updated later
   - [ ] The document changes have been made in apache/echarts-doc#xxx
   
   
   
   ## Misc
   
   ### ZRender Changes
   
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   N.A.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### Other information
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to