Chart for weeks

-1

Hello everyone, I'm trying to put together a graph that displays the data grouped by weeks, as in the example below:

In this example Domimog had 2 records, Second 2 records, Tuesday 1 records ...

I'm trying with plugins, libraries (Chats.js, google chart, etc.) but I still could not do it in this format.

I accept suggestions for alternatives.

Note, I use angular js in my project.

    
asked by anonymous 30.12.2015 / 23:49

1 answer

0

I would use the line chart in chartjs.org would look like this:

var myBarChart = new Chart(cox).Line(data, options);
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
    {
        label: "My First dataset",
        fillColor: "rgba(220,220,220,0.2)",
        strokeColor: "rgba(220,220,220,1)",
        pointColor: "rgba(220,220,220,1)",
        pointStrokeColor: "#fff",
        pointHighlightFill: "#fff",
        pointHighlightStroke: "rgba(220,220,220,1)",
        data: [65, 59, 80, 81, 56, 55, 40]
    },
    {
        label: "My Second dataset",
        fillColor: "rgba(151,187,205,0.2)",
        strokeColor: "rgba(151,187,205,1)",
        pointColor: "rgba(151,187,205,1)",
        pointStrokeColor: "#fff",
        pointHighlightFill: "#fff",
        pointHighlightStroke: "rgba(151,187,205,1)",
        data: [28, 48, 40, 19, 86, 27, 90]
    }
]
};

This example is for months, you can easily switch to weeks. Group the data on the server and in case you would only have one dataset, each dataset is one line in the chart.

Or you can use the bar chart, the dataset is the same what changes is just the chart type:

var myBarChart = new Chart(ctx).Bar(data, options);

Group the data on the server and get it via Ajax

    
31.12.2015 / 00:30