Visualizations using D2 and DHiS2 UI library

Hello Team, help me to dhis2 UI library to visualize data in charts in the web custom app. I found no UI from the storybook website

Hi @BernardMasache

It is possible to retrieve the values of a chart in the Data Visualizer app and then create your own visualization. The UI storybook is meant to help developers use the same theme and elements that the DHIS2 web app uses; however, it will not give you a complete and ready to use chart.

If you want the visualization to be automatically generated you could use an API request that will display the SVG version of the visualization and then embed the SVG in your app.

I hope this helps!

Thanks!

Hi @Gassim is there any documentation I can go through on how to achieve this? Any help will highly be appreciated.

1 Like

Hi @MiltonIsaya

Sorry, which method are you asking about specifically? Would you explain more about what you’re trying to achieve?

Unfortunately, I don’t remember how to get the SVG directly from the API. There’s an SVG conversion endpoint which converts the svg into png (you need the svg code) https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-238/analytics.html?h=svg+develop#webapi_svg_conversion.

@Gassim I really appreaciate. this is helpful

1 Like