Create a new chart with the input of the user #32117
Replies: 1 comment
-
Hey @dawfunes! 👋 I'm here to help you with any bugs, questions, or contributions you need assistance with. Let's tackle this challenge together! To create a new chart with user input, such as a date range, using the API, you can follow these steps:
Here's a basic example of how you might structure the API request in JavaScript: fetch('/api/v1/chart/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfToken, // Ensure you include the CSRF token for authentication
},
body: JSON.stringify({
// Include user-defined parameters here
time_range: selectedTimeRange,
// Other chart configuration details
}),
})
.then(response => response.json())
.then(data => {
console.log('Chart created:', data);
})
.catch(error => {
console.error('Error creating chart:', error);
}); This approach allows you to dynamically create charts based on user input, such as date ranges, and retrieve data from the PostgreSQL database accordingly [1][2]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have an application where i want to give the user the chance to give an input, such as a date range and get back a chart accordingly with the data from the database (postgresql). I want to automate this using the API, how would i do the creation of the chart?
Thanks to everyone and for the time being, @dosubot any ideas?
Beta Was this translation helpful? Give feedback.
All reactions