You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "GitHubWebStudioMakerPerfect (via GitHub)" <gi...@apache.org> on 2024/09/19 15:58:10 UTC

[I] series.renderItem send other parameters to the callback function [echarts]

GitHubWebStudioMakerPerfect opened a new issue, #20359:
URL: https://github.com/apache/echarts/issues/20359

   ### Version
   
   each one
   
   ### Link to Minimal Reproduction
   
   -
   
   ### Steps to Reproduce
   
   If there are more then one charts in a single page and you got a function like this to change the graph type
   ```
   function setGraph_chartName1_to_customType(e){ //there are multiple functions like this
   	chartName1.setOption({
   		series: [{
   			customtypename: 'customType',
   			renderItem: renderItemCallback,
   		}]
   	});
          // ... somethings
   }
   ```
   and then in `renderItemCallback()` you have to identify the chart needed because the function `renderItemCallback()` it's used for more then one chart (eg. chartName1, chartName2, chartName3)
   
   
   ### Current Behavior
   
   ```
   function renderItemCallback(params, api) {
   	var points_array = chartName1.getOption().dataset[0].source; //HERE IS NEEDED THE CHART OBJECT
   	if (points_array.length) {
                // ... somethings
   	}
   }
   ```
   how to get `chartName1` as referer inside `renderItemCallback` function?
   
   
   ### Expected Behavior
   
   Also, there's a way to send other parameters to the callback function in addition to `params, api` (anyway to identify the graph you are working on)?
   
   Anyway thanks. From some days eCharts it's my love!
   
   ### Environment
   
   ```markdown
   - OS: each one
   - Browser: each one
   - Framework: each one
   ```
   
   
   ### Any additional comments?
   
   _No response_


-- 
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: commits-unsubscribe@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] series.renderItem send other parameters to the callback function [echarts]

Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia commented on issue #20359:
URL: https://github.com/apache/echarts/issues/20359#issuecomment-2362689979

   We are going to provide `series.itemPayload` in ECharts v6. Here's a preview: https://github.com/apache/echarts/blob/v6/test/custom-register.html . v6 is expected to be released earlier next year. If you are interested in using it now, you may check out the `v6` branch.


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] series.renderItem send other parameters to the callback function [echarts]

Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
helgasoft commented on issue #20359:
URL: https://github.com/apache/echarts/issues/20359#issuecomment-2361975270

   > How to get `chartName1` as referer inside `renderItemCallback` function?
   
   One solution is to set it in series _id_ or _name_ and get it in [params](https://echarts.apache.org/en/option.html#series-custom.renderItem.arguments.params). Then _eval()_ etc.
   [Demo](https://echarts.apache.org/examples/en/editor.html?code=E4UwdgJiwJIC4gLYAIC8yBmBXMBjOAlgPZjIAUADgIbBWIDOANMlRQQJTIDeAUMsvVLpqtBgDp60AiHowIAbj7ICiKgHMQaJf0Fp0AclxEA7vu39kAfmT6AFnDgV6ALgD0rkLls049MayovEDEiYDUPAA86CgAbGVcIKjgqVyp6SThXDSJXACEQEAwAfVwsXyKAMVo8YPoANzUzCwtnG3tHF3cAI1xgroh6ZMJcMSNEBJA6kBiiCmgAWkGkglxXFTV6VOBhuK2dkCLEAE8xCjBGxX44uGQIgDUqGKxNdFYCMTrH57IABnZL5DXZBHB5PF4sNgfL4gMgARn-SiBETQEPeRlCEDIAG17tDmD8ALrsLGExjmI4ot6jIgY7E_Zgg6FErGwgkAoHGAgQOC2FEAVnp5lsIAIansKIATHz2SAbsAiENiEJUVCwWQJQj-KA4FhgKReM04Ec5q19Gp5VgKPoyc0vAQYhBQGBWljzPwDc0LEaTTYVOoQNa3RYAF4S1oSm2erUK5YkVryxUkSNRgAkgUIcZsoFigQDyc9cGq9AIGedWZjpcDUf4oVFBDAAA1WsiANTITnc3muZARoM14B1sAATVaFPmyGFovF3d71YERrirQ9c79GnzUYizfXnqOo-Q48nYrg2-aHZ5rTPthPFkP9lat7gfeQAF8g8_t8uC8aQKaEBE4FW1abrc167sCzDuPuE4ike16XheXI8teD73jB9jXoMRyLtwT78H-cCtCIdB-JIA4yHI178Bg9oxKaXRgk01avlGzEWASSjPoonE8LMpYoh6EQAIIRAQLg4c0iTJC6-hUNaNhdHJhiKRAil5jYGD6Ox_DvkoRzCaJS46fwklpLKLrmJ-OhELqvTmXOWIyXJADMzAACx8gS14OQpbnMAAnKST4ObgcmwvinlBfoKnMBGyCwoF
 9n6GpTliC5yBOQl1YORpbliK5zAClpnpFdp-aWQI1nALZyCuolskxW5HlefoPnpf5mVRsFcn0sgHWeg50Vxcw8UlWx5isRFOhSDIdkWOV3o_jYpSDEQiCAc0XKmkYpjbk6UCwAgiDjWVQYLVtWArWt26bUtNDRUGe3QPASDbiZGQwJAIDAbC41KOxnFAA) of similar scenario.
   
   


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] series.renderItem send other parameters to the callback function [echarts]

Posted by "GitHubWebStudioMakerPerfect (via GitHub)" <gi...@apache.org>.
GitHubWebStudioMakerPerfect commented on issue #20359:
URL: https://github.com/apache/echarts/issues/20359#issuecomment-2380638232

   @Ovilia 
   It might be right not so much for bugs, but for performances as it is true that it slows down the system a lot. But the answer to the question on StackOverflow works. It works wonderfully.
   
   In my case I can't use `const rawData = api.value(xDim, i);` because the parameters are not passed using `series.data`, but rather `dataset.source`. So the code you reported, with all due respect for your work that I respect and appreciate and for your collaboration with eCharts that has become my favorite pastime for some time, is useless for me because the data is passed to the chart through a large initial array, without dividing it into series.
   In any case, thank you for your time.
   Bye πŸ‘‹


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] series.renderItem send other parameters to the callback function [echarts]

Posted by "Ovilia (via GitHub)" <gi...@apache.org>.
Ovilia commented on issue #20359:
URL: https://github.com/apache/echarts/issues/20359#issuecomment-2367303922

   @GitHubWebStudioMakerPerfect The anwser in the StackOverflow is not recommended because it's not suggested to call `getOption` from renderItem, this may cause potential performance problems and bugs hard to debug. Please use the way as I answered above when possible.


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] series.renderItem send other parameters to the callback function [echarts]

Posted by "GitHubWebStudioMakerPerfect (via GitHub)" <gi...@apache.org>.
GitHubWebStudioMakerPerfect commented on issue #20359:
URL: https://github.com/apache/echarts/issues/20359#issuecomment-2363916010

   Beautiful cow and cards, but
   
   #### Has been already answered here:
   
   https://stackoverflow.com/questions/79004206/how-to-know-what-graph-are-you-referring-with-multiple-echarts-graphs-in-one-pag
   
   It works so well I was shocked.
   
   TNX @helgasoft @Ovilia I really like Apache eCharts a lot πŸ«ΆπŸ’‹πŸ‘‹


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


Re: [I] series.renderItem send other parameters to the callback function [echarts]

Posted by "GitHubWebStudioMakerPerfect (via GitHub)" <gi...@apache.org>.
GitHubWebStudioMakerPerfect closed issue #20359: series.renderItem send other parameters to the callback function
URL: https://github.com/apache/echarts/issues/20359


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org