This is not really a web2py question. You have to use a JS library. For 
example:

1) download http://www.chartjs.org/assets/Chart.min.js into 
yourapp/static/js

2) create a controller like

def index():
     response.files.append(URL('static','js/Chart.min.js')) 
     data = {
        'labels': ["January", "February", "March", "April", "May", "June", 
"July"],
        'datasets': [{
            'label': "My First dataset",
            'fillColor': "rgba(220,220,220,0.5)",
            'strokeColor': "rgba(220,220,220,0.8)",
            'highlightFill': "rgba(220,220,220,0.75)",
            'highlightStroke': "rgba(220,220,220,1)",
            'data': [65, 59, 80, 81, 56, 55, 40]
        },{
            'label': "My Second dataset",
            'fillColor': "rgba(151,187,205,0.5)",
            'strokeColor': "rgba(151,187,205,0.8)",
            'highlightFill': "rgba(151,187,205,0.75)",
            'highlightStroke': "rgba(151,187,205,1)",
            'data': [28, 48, 40, 19, 86, 27, 90]
        }]}

then create a view like:

{{extend 'layout.html'}}
<canvas id="myChart" width="400" height="400"></canvas>
<script>
{{=ASSIGNJS(data=data) # pass data from controller to JS}}
jQuery(function(){
   var ctx = document.getElementById("myChart").getContext("2d");
   var myBarChart = new Chart(ctx).Bar(data);
});
</script>

at voila'!

On Saturday, 21 February 2015 05:16:34 UTC-6, T.R.Rajkumar wrote:
>
> I want to display a bar chart. I went through the book, wiki plugins 
> widget bar chart. I am unable to comprehend the matter. So pl. tell me what 
> I should write in the controller and view to show a bar chart. Thanks in 
> advance.
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to