Giter VIP home page Giter VIP logo

sphinx-charts's People

Contributors

thclark avatar toodizzy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sphinx-charts's Issues

dirhtml builder does not work properly

When using dirhtml as builder, everything appears to work fine. However, in pages other than index.rst the charts won't be shown. I suppose it's a path resolution issue, but couldn't really pinpoint where the problem is.

No graphs displayed in Github Pages

I have the documentation hosted on Github Pages, and I could display the graphics correctly, until I decided to update Sphinx and the pydata-sphinx-theme.

Before the update I had the following versions:
Sphinx 6.1.3
pydata-sphinx-theme 0.12.0
sphinx-design 0.3.0
myst-parser 0.18.1

After upgrading to the latest version of Sphinx and pydata, the following versions resulted:
Sphinx 7.0.0
pydata-sphinx-theme 0.13.3
sphinx-design 0.4.1
myst-parser 1.0.0

There are some other libraries that were also updated (I don't remember which ones), but they were not directly related to Sphinx.

I've tried downgrading to the original versions of the mentioned packages, but I can't get the graphics to work again. I don't know what else to try, any ideas on what might be causing the problem? The chart area shows "loading" indefinitely.

image

Allow generation of PDFs in addition to HTML outputs

For generation of technical reports, it's extremely useful to be able to render charts to a static version and embed them into a PDF using LaTeX.

Without doing this, we can't make reports downloadable (currently, reports are HTML only, and although they could be downloaded, they'd need a local server so the viewer would need some significant technical expertise).

Proposed solution

Need to add a builder specifically to generate static chart image at build time then invoke it as an alternative to the html builders here

Version 0.0.4 not compatible with latest version of Sphinx (4.3.2)

Hey,
trying to upgrade to the latest version of Sphinx - version 4.3.2 - but this module doesn't seem to be compatible.
Any plans on addressing this, or any clues on how to fix this?

When running pip3 install -U Sphinx, I'm getting the below error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sphinx-charts 0.0.4 requires sphinx<4,>=2, but you have sphinx 4.3.2 which is incompatible.

And when trying to build the site anyway, then this error happens:

  File "/usr/local/lib/python3.9/site-packages/sphinx_charts/charts.py", line 242, in setup
    app.add_javascript(path)
AttributeError: 'Sphinx' object has no attribute 'add_javascript'
The full traceback has been saved in /var/folders/p8/h425k82s2r3cy03hyqyhst7w0000gp/T/sphinx-err-sxpazmrg.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
Command exited with exit code: 2
The server will continue serving the build folder, but the contents being served are no longer in sync with the documentation sources. Please fix the cause of the error above or press Ctrl+C to stop the server.

Chart jsons not loaded when opening the html file in broswser directly, because ajax calls to local files are not allowed

Expected
Opening an html file in browser loads the charts and displays correctly

What happens
Opening an html in a browser (right click > open with > chrome, for eg.) does not load the chart jsons.

Reason
Chrome (and Edge, haven't tested other) doesn't allow ajax calls to be made to local files.

Workarounds
To get the setup to work, launch Chrome with the flag --allow-file-access-from-files.

Possible solution

  • Embed the json data directly in the html (if its small)
  • Embed data in a script file and load the file with 'defer' or 'async'
  • Use the script tag data import work around (if its large)

Proposal: Add user defined class or id to the chart when embedding chart in html

The use case is to style the charts (not necessarily the chart itself but at least the chart container) that have been embedded in the final html. The more specific use case is when adding a plotly table, it comes with a border and padding which makes the table look like it wants nothing to do with everything around it.

I'm not sure this is an antipattern or if this can be achieved some other way, but what good is an html element that can't be styled?

This is only a proposal, just wanted to know what you think about it.

New version of graph isn't rendered in browser upon regeneration of JSON

Hey,

I got Plotlyand this plugin to work nicely together, but as I am setting up the work pipeline I am regenerating the same graph multiple times.
Everything works great on the first render, but when I change the graph JSON, then nothing happens in the browser - i.e. no changes are reflected.

I sure that there's cache somewhere, because when I rename the newly generated file, then everything works as expected.

Any hint or clues on how to clear what ever cache or other mechanism that is blocking this re-render?

Using the following versions and is running this on macOS 10.14:

sphinx_charts>=0.0.4
plotly>=5.4.0
pandas>=1.3.5

Python 3.9.9

Incorrect linking of json asset from non-root pages

A relative, not absolute, link is given to the javascript that renders the chart.

Say you have a non-root page at

examples/look_at_my_charts.rst

And it includes a chart whose json is kept alongside the .rst file:
examples/chart_to_look_at.json

sphinx-charts will place the json file at _charts/examples/chart_to_look_at.json but the browser can't find it because the path isn't necessarily correctly resolved... The browser will try to fetch:

examples/_charts/examples/chart_to_look_at.json

Fix can be inspired by the Include directive which shows the path resolution:

class Include(BaseInclude, SphinxDirective):
    """
    Like the standard "Include" directive, but interprets absolute paths
    "correctly", i.e. relative to source directory.
    """

    def run(self) -> List[Node]:
        if self.arguments[0].startswith('<') and \
           self.arguments[0].endswith('>'):
            # docutils "standard" includes, do not do path processing
            return super().run()
        rel_filename, filename = self.env.relfn2path(self.arguments[0])
        self.arguments[0] = filename
        self.env.note_included(filename)
        return super().run()

Latest sphinx-charts doesn't render all charts

This is outstanding for some time, and has been hidden because readthedocs doesn't automatically update 'latest' to the default branch on github.

There's a problem with rendering some charts. Here, the top one renders but the bottom one doesn't:
Screenshot 2022-05-06 at 15 19 35

Looking in the devtools, there seems to be this problem with the javascript:

plotly-2.8.3.min.js:37 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Queue')
    at plotly-2.8.3.min.js:37:682866
    at plotly-2.8.3.min.js:37:683951
    at new Promise (<anonymous>)
    at Object.r.convertToTspans (plotly-2.8.3.min.js:37:682716)
    at A (plotly-2.8.3.min.js:37:480640)
    at Array.w (plotly-2.8.3.min.js:37:479904)
    at Array.Y.call (plotly-2.8.3.min.js:7:51643)
    at SVGGElement.<anonymous> (plotly-2.8.3.min.js:37:483252)
    at plotly-2.8.3.min.js:7:51569
    at ut (plotly-2.8.3.min.js:7:47935)

Update outdated hard-coded references

The specific plotly version is referred to in

  • the error message currently shown when plots fail to load
  • the README

But, it changes and is now out of date. At the time of writing we use 2.11.1, while 1.55 and 2.8.3 are both referred to.

We should remove all references to specific plotly versions where they're hard coded. Perhaps we could parameterise and include in the docs?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.