Open abnitchauhan opened 5 years ago
Hello,
Please give your code, including the dataset, so that we could reproduce your problem
Hi there
Here is my php code ,
<?php $query = "SELECT tots.*, @var := @var + tots.
count FROM ( SELECT YEAR(created_at) AS
year, MONTHNAME(created_at) AS
month, COUNT(*) AS
count`
FROM users
GROUP BY month ORDER BY year DESC
) AS tots, (SELECT @var := 0) AS inc" ;
$result = mysqli_query($conn, $query) ;
$json_data=array();
foreach($result as $rec)
{
// value on x axis
$json_array['label']=$rec['month']."/".$rec['year'];
// value on y axis
$json_array['value']=$rec['count'];
array_push($json_data,$json_array);
}
//$chart_data = substr($chart_data, 0, -2) ;
?>`
And Here is my javascript Code :
' '
The data I am fetching is this
It would be great you provide directly the dataset in javascript, I mean the content of JSON... So I just need to copy / paste... I do not need the PHP / MySQL..
Ofcourse . Here is the JSON
{"label":"February 2019","value":"4"}{"label":"January 2019","value":"6"}{"label":"March 2019","value":"5"}{"label":"December 2018","value":"2"}{"label":"November 2018","value":"3"}{"label":"October 2018","value":"2"}
Seems the label are too long. You can try with shorter label, like Jan-19
instead of January 2019
.
The x-axis of my chart shows the phone number ,like 082111111750,last lable is not showing,i can not fix it
I have created A morris Line chart By fetching data from the MySQL Table . The problem I am getting is that Its not showing the first and last label of the x-axis.
Here is the Image :