Anania Docs
Search…
⌃K
📈

Rendering Charts

Whenever applicable, the Question endpoint will provide an additional JSON plot object following the Plotly JSON chart schema. In order to render the plots in the Frontend, one needs to use a Plotly client and simply render the plots form the JSON object.
Plotly clients are available in several languages including Plotly.JS which can be used with various JS frameworks.
Below is a ReactJS snippet that defines a small function, which allows rendering the plots from the response received from the Anania's question API endpoint.
import Plot from 'react-plotly.js';
​
const get_chart = (res) => {
const chart_data = res['Output chart']
​
return <Plot
data={chart_data['data']}
layout={chart_data['layout']}
/>
}