Look into dashboard.js. It contains code like:
var line = new Morris.Line({
element : 'line-chart',
resize : true,
data : [
{ y: '2011 Q1', item1: 2666 },
{ y: '2011 Q2', item1: 2778 },
{ y: '2011 Q3', item1: 4912 },
{ y: '2011 Q4', item1: 3767 },
{ y: '2012 Q1', item1: 6810 },
{ y: '2012 Q2', item1: 5670 },
{ y: '2012 Q3', item1: 4820 },
{ y: '2012 Q4', item1: 15073 },
{ y: '2013 Q1', item1: 10687 },
{ y: '2013 Q2', item1: 8432 }
],
xkey : 'y',
ykeys : ['item1'],
labels : ['Item 1'],
lineColors : ['#efefef'],
lineWidth : 2,
hideHover : 'auto',
gridTextColor : '#fff',
gridStrokeWidth : 0.4,
pointSize : 4,
pointStrokeColors: ['#efefef'],
gridLineColor : '#efefef',
gridTextFamily : 'Open Sans',
gridTextSize : 10
});
What you have to do is replace input with something that you can pass from
the server. There are many ways. I am going to suggestsimple solution
without ajax which assume the html has been converted into a template
var line = new Morris.Line({
element : 'line-chart',
resize : true,
data : MY_DATA_1,
xkey : 'y',
ykeys : ['item1'],
labels : ['Item 1'],
lineColors : ['#efefef'],
lineWidth : 2,
hideHover : 'auto',
gridTextColor : '#fff',
gridStrokeWidth : 0.4,
pointSize : 4,
pointStrokeColors: ['#efefef'],
gridLineColor : '#efefef',
gridTextFamily : 'Open Sans',
gridTextSize : 10
});
Then in the controller that serves the page
def index():
data = [
{ y: '2011 Q1', item1: 2666 },
{ y: '2011 Q2', item1: 2778 },
{ y: '2011 Q3', item1: 4912 },
{ y: '2011 Q4', item1: 3767 },
{ y: '2012 Q1', item1: 6810 },
{ y: '2012 Q2', item1: 5670 },
{ y: '2012 Q3', item1: 4820 },
{ y: '2012 Q4', item1: 15073 },
{ y: '2013 Q1', item1: 10687 },
{ y: '2013 Q2', item1: 8432 }
]
return dict(mydata1 = data)
and in the template, before <script src="dashboad.js"/> you add
<script>{{=ASSIGNJS(MY_DATA_1 = mydata1)}}</script>
This was the data is defined in python, passed to the template, stored in a
js variable, and made it visible to the dashboard.js code.
On Saturday, 8 June 2019 12:25:41 UTC-7, Paul Arsenio Blanco Reyes wrote:
>
> Recently I found the theme "AdminLTE" (
> https://adminlte.io/themes/AdminLTE/index.html)
> I have already implemented it in my application. I would like to generate
> some graphics like those that appear in the preview but I don't know how yo
> do it. Would any of you can help me with any example to understand how I
> can generate them. I will thank you infinitely.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/2f5fd918-9215-413d-8141-c9112b7a3c03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.