score:1
you can send the queryset to the template in the context and use the values there.
class yourtemplate(templateview):
def get_context_data(self, **kwargs):
requestcnt = activitylog.objects.annotate(request_count=count('requesttype')).values('dodate', 'request_count')
context = super().get_context_data(**kwargs)
context["data"] = requestcnt
return context
then in your template, you can use data
variable to get the data for both the axis. the data will be of the format:
[{"dodate":"...", "request_count":"..."}, {"dodate":"...", "request_count":"..."}]
Source: stackoverflow.com
Related Query
- How can I pass my sqlite data to django, and make chart?
- How can I display the xAxes and yAxes data in the tooltip, Chart JS?
- How can I get my Chart.JS bar chart to stack two data values together on each bar, and print a calculated value on each bar?
- How can I process json file and display some data in form of charts in django
- how can I make selected data is highlighted on chart js?
- How can I build some chart with Chart.js and ng2-charts using an array of revenus & budgets per month date as Data source?
- How can I make two of my lines in Chart JS thicker
- How can I make a stepline or stepped chart in chart.js or D3?
- Chart js: how can I align the legend and the title
- How to show data values in top of bar chart and line chart in chart.js 3
- How can I make line on chart thinner?
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to select and pass array object to data setting of chart.js config?
- How can I achieve displaying data points on chart but Dotted? Chart.js V3.7.0
- How to get chart from data points (arrays) with inconsistent time intervals and chart.js?
- How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js
- Angular 2: How to pass my API data to graph and Display the Graph with data
- How can I have different values for the chart and the tooltip in chart.js?
- how can i use chart.js to create a chart that has one time series line and one linear line on it at the same time?
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- How can I make streaming chart with react?
- how labels in chartjs can make data invisible
- How to make a chart with chartjs and Angular?
- How can i display my data in a chart using chart js
- how can i show labels and value in both on bar chart
- How can make my chart.js dynamic using data from database
- Chart.js How can I embed additional values to each data point in radar chart
- How can i loop some specific key in each index json data and put it in dataset: data ? (chart.js)
- React - How can I pass API data from one component to another in a different js file?
- How can I reduce the spacing between my legend and chart proper in my Chart.JS bar chart, and increase it in the graph area?
More Query from same tag
- html2canvas Capture a chart.js-Chart with the size of full screen on different window size
- Change 'points' on a line chart to donuts using Chart.js
- how to remove duplicate data set labels in chartjs
- ChartJS Tooltip - Change Data Format Displayed
- How to use two Y axes in Chart.js v2?
- Multiple dynamic vertical lines on a chart with Chart.js
- How to know which stack is clicked, in a grouped stacked bar (chartjs)?
- Chart.js Radial axes: is it possible to use multiple axes on radar chart?
- ChartsJS Legend not showing in Angular11
- Is there a way to store a chart as an image directly to server using Chart.js?
- ChartJS and Ajax calls
- Set minimum step size in chart js
- Chart.js - style legend: smaller circles
- chartjs plot datetime value with time offset on the grid
- How to achive Chart JS weather chart of 5 day / 3 hour forecast data
- Sorting the Bars in Chart.JS Bar Graph
- Formatting Chart.js Chart
- How to edit the ID of each button in a class if a condition is true in JavaScript?
- ChartJS – How to show border on empty pie chart?
- Charts.js Y-Axis whole Numbers
- Angular js install external library failed to instantiate module npm
- Send data from php to chart with ajax
- Set Scope in Angular-Charts.js after rendering
- chart.js tooltip keeps remembering old data after update
- Changing color of specific chartjs point
- react-chartjs-2 Line Chart not updating with State
- ChartJS Line chart causes browser crash
- Php array and chartjs
- I can not properly re scale <canvas> with width and height attributes
- Pausing Javascript animation on minimize