-
Notifications
You must be signed in to change notification settings - Fork 792
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
Candlestick gallery example has no data visible #910
Comments
I just checked on my laptop and on my mobile phone, perhaps try again or refresh? It might have been a momentary issue. |
Do you have adblock? Sometimes adblock overzealously blocks Vega-Lite from accessing URL data sources. |
Thanks for the comments. I have checked this on Windows, OSX, and iOS and see the following:
Note All the other examples in the gallery that I looked at worked and when I have made visualizations in a jupyter notebook I have gotten them to work as expected on Firefox on both the Mac and Windows 10. The only time I have seen this issue is with the Candlestick example in the combinations of browser/OS described above. Let me know what else I can do the help diagnose/fix this issue. |
Is there any error in the javascript console when the chart fails to show? |
Also, if you click "Open in Vega Editor", does the chart fail to show there as well? |
When loading the page from the docs I get the following errors in the console:
When I open in the Vega Editor the chart looks the same with no bars and the warning This was done on mac osx Firefox 60.0.1 (64-bit). |
The warning is not a problem, but the "Source map error" indicates something is wrong. I'd raise the issue on the Vega-Lite repo: we can't do anything in this repository to address this kind of error. |
@jakevdp Thanks for the help. I am getting started with altair and I am not sure how to make a minimal example in vega-lite to test/show the issue. Can I just use the altair docs example? If not, how is the best way to get the generated vega-lite code out of the python/html to add to the issue? |
I see the "view source" link now. Working on the issue now. |
The source map error is not actually an error as sourcemaps are optional and the error is unrelated to it. One problem I noticed is that the example uses a non-standard date format. I fixed it in #915. |
@domoritz @jakevdp I have developed a minimal example that shows the issue exists even with ISO date string formats import altair as alt
import pandas as pd
alt.renderers.enable('notebook')
df = pd.DataFrame(
[
{
"date": "2009-06-01",
"open": 28.7,
"close": 30.04,
},
{
"date": "2009-06-02",
"open": 30.04,
"close": 29.63,
},
{
"date": "2009-06-03",
"open": 29.62,
"close": 31.02,
},
]
) now create just the bar chart part of the candlestick plot bar = alt.Chart(df).mark_bar().encode(
x='yearmonthdate(date):T',
y='open',
y2='close',
)
bar the plot has x and y axis with labels, but no data and the generated json is {
"config": {"view": {"width": 400, "height": 300}},
"data": {
"values": [
{"close": 30.04, "date": "2009-06-01", "open": 28.7},
{"close": 29.63, "date": "2009-06-02", "open": 30.04},
{"close": 31.02, "date": "2009-06-03", "open": 29.62}
]
},
"mark": "bar",
"encoding": {
"x": {"type": "temporal", "field": "yearmonthdate(date)"},
"y": {"type": "quantitative", "field": "open"},
"y2": {"type": "quantitative", "field": "close"}
},
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.1.json"
} I copied this json into https://vega.github.io/editor/#/edited and found the plot looks that same as in my jupyter notebook (no data bars) and the vega editor reports Next I removed the bar2 = alt.Chart(df).mark_bar().encode(
x='date:T',
y='open',
y2='close',
)
bar2 and the plot has bars on it. The vega code generated is {
"config": {"view": {"width": 400, "height": 300}},
"data": {
"values": [
{"close": 30.04, "date": "2009-06-01", "open": 28.7},
{"close": 29.63, "date": "2009-06-02", "open": 30.04},
{"close": 31.02, "date": "2009-06-03", "open": 29.62}
]
},
"mark": "bar",
"encoding": {
"x": {"type": "temporal", "field": "date"},
"y": {"type": "quantitative", "field": "open"},
"y2": {"type": "quantitative", "field": "close"}
},
"$schema": "https://vega.github.io/schema/vega-lite/v2.4.1.json"
} and in the vega editor I see a plot with bars and the the editor reports So it seems the problem is in the call to This was all done on a mac with firefox. How can I help further? |
Does Altair support timeunit as a string in the field? |
GitHub closed it automatically because it was mentioned there. I'll reopen. |
I am having a similar issue but can't create a reproducible example yet so just posting a comment here in the interim. If I open the site https://viz-learn.mds.ubc.ca/en/module3 in Firefox, click "1 How to visualize....", then "Slides" and then go forward a few slides, only the first 1-2 plots have points for me, the rest only show the axis and the chart background. It works fine in Chromium. In the developer console for Firefox I see this
I tried turning of HTTPS everywhere, strict privacy mode, containers, and all addons, but the error is still there. Possibly related to #2539, although the error console there appears to show something else. |
The example on the website https://altair-viz.github.io/gallery/candlestick_chart.html#gallery-candlestick-chart shows axis and vertical rules, but no bars of data.
I have copied the code locally and run it and get the same result.
The text was updated successfully, but these errors were encountered: