-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Show/hide Series #15585
Comments
Hi! We've received your issue and please be patient to get responded. 🎉 In the meanwhile, please make sure that it contains a minimum reproducible demo and necessary images to illustrate. Otherwise, our committers will ask you to do so. A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster. You may also check out the API and chart option to get the answer. If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question. If you are interested in the project, you may also subscribe to our mailing list. Have a nice day! 🍵 |
If the original requirement is:
If there is no data, the series will not be displayed automatically. |
Hey! In our case, we are providing dataset and encode to multiple series and we need to be able to show/hide specific series, but keep all hidden series configurations, parameters, encode etc. |
@Rushan4eg According to ECharts's mechanism, the suggested way to do this is to pass the series to display to |
I would like to have an option to define an invisible series element.
or
This would allow to hide certain data point from the graph. |
Are there any updates to this issue ? Would really be awesome to be able to disable an entry in the series by default ( while the user can enable them via the legend if they wish to ) |
Also want to know any updates on this issue? I need the option to show or hide some series just like in Highcharts example: https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-visible/ Also, is there API to do this like |
Found this a little surprising too. Nearly everything in the options has For now I'm just calling |
This feature helps when there are multiple series (ex. 50 + line series) in one chart, then to view the one of interest by programatically setting visible false for all other. |
Recently faced the same problem. The solution was not very obvious. To prevent one of the series from being shown in the legend, in the settings of the series you want to hide, put |
Series visibility while rendering for the first time can be controlled by this option - https://echarts.apache.org/en/option.html#legend.selected |
This is still an issue. If you are dynamically changing the number of elements in options.series, and the new options.series you are merging in has fewer elements than are currently in the chart instance's series, the series may not be shown in the chart, but it is still shown in the legend. You can format the legend to not have a name for these series elements, but the accompanying legend icons (line, circle, etc.) still are shown. The option of using setOption(options, true) to reset the series can work, except that it loses the current magic type (bar or line, stacked or unstacked). If you set new options to match these values, the restore toolbox action no longer restores to the original state of the chart, but to the merged options type and stack used to emulate the magic type state that is whiped out by the setOption necessary to fix the issue of not being able to remove series elements. I have yet to successfully use the on event capture of 'restore' to override the charts restore to set it back to the original type and stack. But again, all of this is a lot of extra steps just because you cannot remove an element from the series. Please enable the removal of series elements. |
Related issue here. I have a series without any data that I use for displaying markpoints. You can use
easily enough to toggle the visibility as hiding the series also hides the mark points. But you can't hide the mark points by default and just toggle them on when you need them. |
Good afternoon. Faced a similar problem. I need to hide the data from the chart but display it in the tooltip. |
Setting line style opacity to zero hides a series, see e.g. documentation for 'line'. This isn't elegant and doesn't animate, but works. I miss a |
This resolves the issue in a certain way, in my case I was trying to handle the visibility through a multiselect with useState and no other solution was working, but this worked like a charm, thanks! |
I need this feature also! |
One way I found to show a serie and hide others and still keep the data into tooltips is to give the ones you want to hide the type "custom" and as a render function an empty function. hope this helps while waiting for this feature |
@fdrcslv How do one force re-render if you already have a custom type and you then set renderItem to an empty function? Both calling |
@helgasoft: See my demo here. I want to have toolbox button to toggle error bars. And while the code works in the following way:
So while I can updating options for the custom series has effect, chart is not redrawn. I have also tried to set I have also used Both series (line and custom) have the same name because I want them to be toggled together by the legend. |
Your code is using series.optionUpdated and series.mergeOption. Where are they documented? |
I see my mistake. I was calling |
+1 for needing this feature. |
+1 |
This should be a useful feature. If anyone wants to make a pull request, please leave a comment. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
What problem does this feature solve?
There are mutiple charts on the page, however, some of them have no data. We need to hide or disable those charts with no data.
What does the proposed API look like?
Would be extremely useful to have in options.series to hide or show specific series
WITH series.visible = true/false
. For example, we have 5 series, but we don't want to show one of them.Also, would be useful to have option to hide series if there is no data in the series.
series.displayWhenNoData= true/false
Waiting and ready to help!
The text was updated successfully, but these errors were encountered: