Skip to content

Conversation

@zhaolei6116
Copy link

Summary:

This PR addresses an intermittent failure in generating static plots due to the dependency on an internet connection when using Kaleido, a Python package that converts HTML to PNG. The fix ensures that static plots can be generated offline by utilizing JSON data alongside HTML files.

Problem Description:

No static plots are saved due to some kaleido problem
The Python package Kaleido requires an internet connection to convert HTML content into PNG images. This has led to failures in generating static plots when working in environments without network access.

Solution Overview:

To resolve this issue, the following changes have been implemented:

  1. Generate JSON Files During Plot Creation:

    • In addition to generating HTML files, the system now also generates corresponding JSON files containing all necessary plot information.
  2. Utilize Plotly for Static Plot Generation from JSON Data:

    • By leveraging the Plotly Python library, static plots are created directly from the generated JSON data. This approach bypasses the need for Kaleido and its dependency on an internet connection.

Implementation Details:

  • Changes in Code:

    • Added functionality to export JSON files whenever HTML files are generated.
    • Modified the plot generation process to use Plotly to render static plots based on JSON data.
  • Testing:

    • Verified that static plots can now be successfully generated both online and offline.
    • Ensured compatibility with existing workflows and configurations.

Additional Notes:

  • This change should not introduce any breaking changes but rather provides a more robust solution for generating static plots under varying network conditions.
  • It is recommended to thoroughly test these changes in different scenarios before merging to ensure they meet all project requirements.

Checklist:

  • The code has been tested locally.
  • All new and existing tests passed.
  • Documentation updated if necessary.

…ment

- Generate JSON files alongside HTML
- Use Plotly to render static plots from JSON data
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

Successfully merging this pull request may close these issues.

1 participant