Skip to content
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

States not setting up for each column in columnSeries #1657

Closed
Ashishvkale opened this issue Aug 5, 2024 · 2 comments
Closed

States not setting up for each column in columnSeries #1657

Ashishvkale opened this issue Aug 5, 2024 · 2 comments

Comments

@Ashishvkale
Copy link

Ashishvkale commented Aug 5, 2024

Here I'm traversing over each column from column series
Want to change color and fill opacity of each column except the hoverd one
Seems like some small piece is missing

Below is the code for same:

         
          columnSeries.columns.template.set("interactive", true)

            columnSeries.columns.template.states.create("dimmed", {
                fill: am5.color(0xcccccc), // Light grey color
                fillOpacity: 0.3 // Semi-transparent
            })

            columnSeries.columns.template.events.on("pointerover", (event) => {
                if (this.chart) {
                    const hoveredColumn = event.target.dataItem?.dataContext as ColumnContent
                        this.chart.series.each((s) => {
                            if (s instanceof am5xy.ColumnSeries) {
                                s.columns.each((column) => {
                                    const columnData = column.dataItem?.dataContext as ColumnContent
                                    if (!this.idsToExclude.includes(columnData.id)) column.states.apply("dimmed")
                                })
                            }
                        })             
                  }
            })

How can we achieve this and apply our state on top even if any adapter or event is adding colors ??

@martynasma
Copy link
Collaborator

You should be able to apply state over any other state.

However, adapter always has the "last say". You can't knock off adapter's value with a state.

If you need to do that, you need to incorporate that check into adapter's code.

Copy link

github-actions bot commented Sep 5, 2024

This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants