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

Add query link for items represented in visualization #34

Open
alexdryden opened this issue Nov 25, 2024 · 1 comment
Open

Add query link for items represented in visualization #34

alexdryden opened this issue Nov 25, 2024 · 1 comment

Comments

@alexdryden
Copy link

I'm investigating methods that would allow users to surface collections of items represented throughout the data visualization.

For example, in a "Count of items with property values" bar chart, there is a desire to be able to direct the reader to all of the items represented by each bar, e.g., to an item query results page for those items. So, for example, in this bar graph, the bar for "Dissertations" (or, its label) would be a link that would be constructed approximately as:
/items?<query_from_the_dataviz_form>&property[0][joiner]=and&property[0][property]=<property_id_from_dataviz_form>&property[0][type]=eq&property[0][text]=Dissertations
Screenshot 2024-11-25 at 2 28 46 PM

The most straightforward way would seem to be adding the link to the labels for the chart as an<a> element around the svg <text> element for each label. Though, adding it to the bars as well may be desirable.

I notice that this feature is suggested by this section of code, but I don't see an existing method to establish a url key in the dataset.

Is there already a way to accomplish what I am suggesting? If it doesn't yet exist, would the implementation involve building the url array and adding it to the dataset to be consumed in the linked section of code?

@jimsafley
Copy link
Contributor

Yes, the solution would be to build the query URL and set it to the "url" key when creating the dataset. A sticking point here is that, if the visualization has a "Search query" set, there's no way to guarantee that the page will have the correct results. A query represented by an individual bar, column, etc. is a subset of the visualization's "Search query." This kind of "subset of a subset" isn't feasible using a URL query, at least currently.

Perhaps we could accept the visualization ID in the URL query and set the subquery that way; but, until that happens, we're not going to add the query link to the diagrams.

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

No branches or pull requests

2 participants