Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I am developing a python chart in my power bi dashboard. The chart works in the PBI desktop version file. However, when I publish the dashboard, I got a script run time error message. See the detail of the error below. Can you help to identify what the issue is here?
Script Runtime Error
File "C:\Python\lib\site-packages\matplotlib\backends\backend_agg.py", line 514, in print_png
FigureCanvasAgg.draw(self)
File "C:\Python\lib\site-packages\matplotlib\backends\backend_agg.py", line 393, in draw
self.figure.draw(self.renderer)
File "C:\Python\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\Python\lib\site-packages\matplotlib\figure.py", line 1736, in draw
renderer, self, artists, self.suppressComposite)
File "C:\Python\lib\site-packages\matplotlib\image.py", line 137, in _draw_list_compositing_images
a.draw(renderer)
File "C:\Python\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\Python\lib\site-packages\matplotlib\axes\_base.py", line 2630, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File "C:\Python\lib\site-packages\matplotlib\image.py", line 137, in _draw_list_compositing_images
a.draw(renderer)
File "C:\Python\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File "C:\Python\lib\site-packages\matplotlib\text.py", line 685, in draw
bbox, info, descent = textobj._get_layout(renderer)
File "C:\Python\lib\site-packages\matplotlib\text.py", line 278, in _get_layout
key = self.get_prop_tup(renderer=renderer)
File "C:\Python\lib\site-packages\matplotlib\text.py", line 846, in get_prop_tup
x, y = self.get_unitless_position()
File "C:\Python\lib\site-packages\matplotlib\text.py", line 828, in get_unitless_position
x = float(self.convert_xunits(self._x))
File "C:\Python\lib\site-packages\matplotlib\artist.py", line 178, in convert_xunits
return ax.xaxis.convert_units(x)
File "C:\Python\lib\site-packages\matplotlib\axis.py", line 1576, in convert_units
f'units: {x!r}') from e
matplotlib.units.ConversionError: Failed to convert value(s) to axis units: '2019-02'
Please try again later or contact support. If you contact support, please provide these details.
Activity ID: 75d0528c-d810-4f59-b332-376f6e0833df
Request ID: 06bd3e9f-2fd3-6b29-877e-848c3edf4272
Correlation ID: 1e9148d4-c56e-1c50-9fb1-d0d0833c6f41
Time: Tue Aug 11 2020 15:04:52 GMT-0700 (Pacific Daylight Time)
Service version: 13.0.14066.71
Client version: 2008.1.02249-train
Cluster URI: https://wabi-west-us-redirect.analysis.windows.net/
Thanks,
Andika
Solved! Go to Solution.
I found out the issue. The data label was not using the correct converted date value for 'Year_Mth' column. So, I revised it to dateset['Date'] and now it is working.
plt.text(dataset['Date'].iloc[i],dataset['Remaining_Balance'].iloc[i] + slider,dataset['Remaining_Balance'].iloc[i],color='black')
🙂
This is the code that I used to develop the chart if it will help your review. Thanks!
dataset['Date'] = pd.to_datetime(dataset.Year_Mth)
You need to make sure that Year_Mth has a format that can be successfully converted to a datetime. Across your entire dataset.
I found out the issue. The data label was not using the correct converted date value for 'Year_Mth' column. So, I revised it to dateset['Date'] and now it is working.
plt.text(dataset['Date'].iloc[i],dataset['Remaining_Balance'].iloc[i] + slider,dataset['Remaining_Balance'].iloc[i],color='black')
🙂
The chart was successfully shown in the desktop version.
I changed the format of the Year-Mth column from text into date "yyyy-mm". Still getting the Script Run Time Error.
@Anonymous , for power bi service, Gateway should also be working - check https://powerbi.microsoft.com/en-us/blog/python-visualizations-in-power-bi-service/
You need to convert your YearMonth string into a numeric value, for example Year*100+Month
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
80 | |
68 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |