{"action":"closed","issue":{"url":"https://api.github.com/repos/nnnick/Chart.js/issues/1502","labels_url":"https://api.github.com/repos/nnnick/Chart.js/issues/1502/labels{/name}","comments_url":"https://api.github.com/repos/nnnick/Chart.js/issues/1502/comments","events_url":"https://api.github.com/repos/nnnick/Chart.js/issues/1502/events","html_url":"https://github.com/nnnick/Chart.js/issues/1502","id":109249405,"number":1502,"title":"Incorrect Plot","user":{"login":"AlvinAnd","id":14921065,"avatar_url":"https://avatars.githubusercontent.com/u/14921065?v=3","gravatar_id":"","url":"https://api.github.com/users/AlvinAnd","html_url":"https://github.com/AlvinAnd","followers_url":"https://api.github.com/users/AlvinAnd/followers","following_url":"https://api.github.com/users/AlvinAnd/following{/other_user}","gists_url":"https://api.github.com/users/AlvinAnd/gists{/gist_id}","starred_url":"https://api.github.com/users/AlvinAnd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlvinAnd/subscriptions","organizations_url":"https://api.github.com/users/AlvinAnd/orgs","repos_url":"https://api.github.com/users/AlvinAnd/repos","events_url":"https://api.github.com/users/AlvinAnd/events{/privacy}","received_events_url":"https://api.github.com/users/AlvinAnd/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-01T08:06:01Z","updated_at":"2015-12-26T04:38:29Z","closed_at":"2015-12-26T04:38:29Z","body":"Hi\r\n\r\nI have a bar graph that's plotting the correct data, but on the incorrect x-axis. Instead of the month selected when adding data, it moves that data to January (always the 1st month, regardless of which month data is added to).\r\n\r\nI'm new to this so perhaps there's something in the code that I've overlooked?\r\n\r\n<script>\r\n    var dataValues =[\r\n    <?php\r\n        $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');\r\n\r\n        for($j = 0; $j < count($months); $j++){\r\n            foreach($kpi as $value) {\r\n                if($value->month_id == $months[$j]){\r\n                    $str = str_replace('%', '', $value->monthly_actuals);\r\n                    echo $str.',';\r\n                }\r\n            }\r\n        }\r\n    ?>\r\n    0];\r\n\r\n    var year = 2015;\r\n\tvar barChartData = {\r\n\t\tlabels : ['Jan/' + year,'Feb/' + year,\r\n                'Mar/' + year,'Apr/' + year,\r\n                'May/' + year,'Jun/' + year,\r\n                'Jul/' + year, 'Aug/' + year,\r\n                'Sep/' + year, 'Oct/' + year,\r\n                'Nov/' + year, 'Dec/' + year],\r\n\t\tdatasets : [\r\n            {\tlabel: \"Off track\",\r\n            \tfillColor : \"rgb(255, 0, 0)\",\r\n            \tstrokeColor : \" rgb(255, 0, 0)\",\r\n            \tpointColor : \" rgb(255, 0, 0)\",\r\n            \tpointStrokeColor : \"#fff\",\r\n            \tpointHighlightFill : \"#fff\",\r\n            \tpointHighlightStroke : \"rgba(255, 0, 0,1)\",\r\n            \tdata : [<?php for($i = 0; $i < 12; $i++) { echo str_replace('%', '', $target->off_track).',';}?>]\r\n            },\r\n            {\r\n            \tlabel: \"Warning\",\r\n            \tfillColor : \"rgb(240, 138, 0)\",\r\n            \tstrokeColor : \"rgb(240, 138, 0)\",\r\n            \tpointColor : \"rgb(240, 138, 0)\",\r\n            \tpointStrokeColor : \"#fff\",\r\n            \tpointHighlightFill : \"#fff\",\r\n            \tpointHighlightStroke : \"rgba(240, 138, 0,1)\",\r\n            \tdata : [<?php for($i = 0; $i < 12; $i++) { echo str_replace('%', '', $target->warning).',';}?>]\r\n            },\r\n            {\r\n            \tlabel: \"No Status\",\r\n            \tfillColor : \"rgb(135, 136, 138)\",\r\n            \tstrokeColor : \"rgb(135, 136, 138)\",\r\n            \tpointColor : \"rgb(135, 136, 138)\",\r\n            \tpointStrokeColor : \"#fff\",\r\n            \tpointHighlightFill : \"#fff\",\r\n            \tpointHighlightStroke : \"rgba(135, 136, 138,1)\",\r\n            \tdata : [<?php for($i = 0; $i < 12; $i++) { echo str_replace('%', '', $target->no_status).','; }?>]\r\n            },\r\n            {\r\n            \tlabel: \"Stretch\",\r\n            \tfillColor : \"rgba(0,98,95,0.2)\",\r\n            \tstrokeColor : \" rgb(0, 98, 95)\",\r\n            \tpointColor : \" rgb(0, 98, 95)\",\r\n            \tpointStrokeColor : \"#fff\",\r\n            \tpointHighlightFill : \"#fff\",\r\n            \tpointHighlightStroke : \"rgba(0,98,95,1)\",\r\n            \tdata : [<?php for($i = 0; $i < 12; $i++) { echo str_replace('%', '', $target->stretch).',';}?>]\r\n            },\r\n            {\r\n            \tlabel: \"Commitment\",\r\n            \tfillColor : \"rgb(128, 195, 66)\",\r\n            \tstrokeColor : \" rgb(128, 195, 66)\",\r\n            \tpointColor : \" rgb(128, 195, 66)\",\r\n            \tpointStrokeColor : \"#fff\",\r\n            \tpointHighlightFill : \"#fff\",\r\n            \tpointHighlightStroke : \"rgba(128,195,66,1)\",\r\n            \tdata : [<?php for($i = 0; $i < 12; $i++) { echo str_replace('%', '', $target->commitment).','; }?>]\r\n            },\r\n            {\r\n            \tlabel: \"Robust\",\r\n            \tfillColor : \"rgb(253,185,19,1)\",\r\n            \tstrokeColor : \" rgb(253,185,19)\",\r\n            \tpointColor : \" rgb(253,185,19)\",\r\n            \tpointStrokeColor : \"#fff\",\r\n            \tpointHighlightFill : \"#fff\",\r\n            \tpointHighlightStroke : \"rgba(253,185,19,1)\",\r\n            \tdata : [<?php for($i = 0; $i < 12; $i++) { echo str_replace('%', '', $target->robust).',';}?>]\r\n            },\r\n            {\r\n\t\t\t\tlabel: \"Performace sheet\",\r\n\t\t\t\tfillColor : \"rgba(0,0,0,0.2)\",\r\n\t\t\t\tstrokeColor : \"rgba(0,0,0,1)\",\r\n\t\t\t\tpointColor : \"rgba(0,0,0,1)\",\r\n\t\t\t\tpointStrokeColor : \"#fff\",\r\n\t\t\t\tpointHighlightFill : \"#fff\",\r\n\t\t\t\tpointHighlightStroke : \"rgba(0,0,0,1)\",\r\n\t\t\t\tdata : dataValues\r\n\t\t\t},\r\n\t\t]\r\n\r\n\t}\r\n\twindow.onload = function(){\r\n\t\tvar ctx = document.getElementById(\"canvas\").getContext(\"2d\");\r\n\t\twindow.myBarChart = new Chart(ctx).Bar(barChartData, {\r\n\t\t\tresponsive: true,\r\n            datasetFill : false,\r\n            datasetStroke : false,\r\n\t\t});\r\n\t}\r\n\r\n    $(document).ready(function(){\r\n        setTimeout(function(){\r\n            $('canvas').css('height', '400px');\r\n        }, 2000);\r\n    });\r\n\t</script>"}}