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

Missing chart id in the rendered chart markup #922

Closed
luveqz opened this issue Aug 10, 2022 · 6 comments · Fixed by #923 or #932
Closed

Missing chart id in the rendered chart markup #922

luveqz opened this issue Aug 10, 2022 · 6 comments · Fixed by #923 or #932
Labels
doc-created This label will be used after the doc-needed request has been satisfied. doc-needed This issue requires documentation updates or additions once it has been completed. enhancement Request to improve or optimize an existing feature or functionality in the project released Indicate that an issue has been resolved and released in a particular version of the product.

Comments

@luveqz
Copy link

luveqz commented Aug 10, 2022

Description:

When you render a post that contains a chart, that chart's div container sometimes includes an element with the visualizer-action class and the data-visualizer-chart-id attribute. We need that attribute to always be present in order to guess that chart's id, but sometimes the attribute is not sent with chart markup.

How to reproduce:

  1. Create a new WordPress instance in tastewp.com (it doesn't require an account).
  2. Accept all the default configuration.
  3. Install Visualizer Plugin.
  4. Create a post that contains a chart.
  5. Open that posts' public URL.
  6. Open the browser's inspector and check the chart's markup: it will not contain any tag with the data-visualizer-chart-id attribute.

Expected behavior:

Posts that contain charts always render a container tag with the data-visualizer-chart-id attribute.

Technical info

  • WordPress v5.9.3
  • Visualizer: Tables and Charts for WordPress v3.7.10
  • Visualizer: Tables and Charts Manager for WordPress AddOn v1.10.7
@girishpanchal30
Copy link
Contributor

Hello @luvejo,

I can't replicate this issue on my local and tastewp instance. charts always render a container tag with the data-visualizer-chart-id attribute if we use frontend action(https://tinyurl.com/2j764mqq) otherwise it will render without the attribute.

You can check here:
With action: https://aspiringcorn.s3-tastewp.com/chart-demo-with-front-end-action/
Without action: https://aspiringcorn.s3-tastewp.com/chart-demo-without-front-end-action/

Can you please share your tastewp instance details here?

Thanks

@luveqz
Copy link
Author

luveqz commented Aug 16, 2022

Oh, I didn't know "Frontend Actions" were required. As a workaround, we're taking the ID out of a CSS class, like this:

document
      .querySelector('.visualizer-front-container .visualizer-front')
      .getAttribute('class')
      .match(/visualizer-front-(\d+)/)

But it doesn't seem very reliable. Could you possibly add a data-visualizer-chart-id attribute that is rendered every time? Or do you know a better way to retrieve the chart's ID from the received markup?

@girishpanchal30 girishpanchal30 added enhancement Request to improve or optimize an existing feature or functionality in the project and removed can't reproduce labels Aug 16, 2022
@girishpanchal30 girishpanchal30 linked a pull request Aug 16, 2022 that will close this issue
girishpanchal30 added a commit that referenced this issue Aug 16, 2022
@girishpanchal30
Copy link
Contributor

Hello @luvejo,

I have added the new filter for add/remove container attributes. for now, you can download the updated plugin from the PR #923.

Add the below filter in the active theme functions.php file.

add_filter(
	'visualizer_container_attributes',
	function( $attributes, $chart_id ) {
		$attributes['data-visualizer-chart-id'] = $chart_id;
		return $attributes;
	},
	10,
	2
);

Thanks

@girishpanchal30 girishpanchal30 added the doc-needed This issue requires documentation updates or additions once it has been completed. label Aug 16, 2022
@ltroya-as
Copy link

Hi @girishpanchal30,

Is it possible to release that change as a patch version?

Thanks!

@girishpanchal30
Copy link
Contributor

Hey @ltroya-as,
We will try to release the new version asap. for now, you can download the updated plugin from PR #923.

Thanks

@vytisbulkevicius vytisbulkevicius linked a pull request Aug 29, 2022 that will close this issue
vytisbulkevicius added a commit that referenced this issue Aug 30, 2022
- Fix update axis baseline color #925 
- Update more features images #926
- Fix update minor grid line field #924 
- Add new filter for container attributes #922 
- Fix axis data format issue #920 
- Chart unique title #915 
- Fix block back button issue #930 
- Userguide broken documentation link #918
pirate-bot pushed a commit that referenced this issue Aug 30, 2022
##### [Version 3.7.11](v3.7.10...v3.7.11) (2022-08-30)

- Fix update axis baseline color [#925](#925)
- Update more features images [#926](#926)
- Fix update minor grid line field [#924](#924)
- Add new filter for container attributes [#922](#922)
- Fix axis data format issue [#920](#920)
- Chart unique title [#915](#915)
- Fix block back button issue [#930](#930)
- Userguide broken documentation link [#918](#918)
@pirate-bot
Copy link
Contributor

🎉 This issue has been resolved in version 3.7.11 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Aug 30, 2022
@AndreeaCristinaRadacina AndreeaCristinaRadacina added the doc-created This label will be used after the doc-needed request has been satisfied. label Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-created This label will be used after the doc-needed request has been satisfied. doc-needed This issue requires documentation updates or additions once it has been completed. enhancement Request to improve or optimize an existing feature or functionality in the project released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants