linegraph.html page is not get displayed.
VidyaCK opened this issue · 15 comments
VidyaCK commented
I am a beginner to php. I am not getting how to display it. Can you help me solve this.
yusufshakeel commented
this repo is using older version of chartjs (v1.x) kindly check the new repo chartjs2
hope this helps
code
https://www.dyclassroom.com/chartjs/chartjs-how-to-create-line-graph-using-data-from-mysql-mariadb-table-and-php
github repo
https://github.com/yusufshakeel/chartjs2
tutorial video
https://www.youtube.com/watch?v=nsnbv3wtW3g&index=5&list=PLG6ePePp5vvZLVjT5mgyxBpkbNBpuAwq9
VidyaCK commented
When I execute the data.php file it is displaying like this.What goes wrong
here.
…On Mon, Oct 23, 2017 at 7:48 PM, Yusuf Shakeel ***@***.***> wrote:
this repo is using older version of chartjs (v1.x) kindly check the new
repo chartjs2
hope this helps
code
https://www.dyclassroom.com/chartjs/chartjs-how-to-create-
line-graph-using-data-from-mysql-mariadb-table-and-php
github repo
https://github.com/yusufshakeel/chartjs2
tutorial video
https://www.youtube.com/watch?v=nsnbv3wtW3g&index=5&list=
PLG6ePePp5vvZLVjT5mgyxBpkbNBpuAwq9
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Aff4OPt9mZSZZ9HPOJbcOSjIrJbPZt6rks5svKAYgaJpZM4QCzC6>
.
VidyaCK commented
Sir,How to solve this? I am not getting where it went wrong?
On Tue, Oct 24, 2017 at 10:30 AM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… When I execute the data.php file it is displaying like this.What goes
wrong here.
On Mon, Oct 23, 2017 at 7:48 PM, Yusuf Shakeel ***@***.***>
wrote:
> this repo is using older version of chartjs (v1.x) kindly check the new
> repo chartjs2
> hope this helps
> code
> https://www.dyclassroom.com/chartjs/chartjs-how-to-create-li
> ne-graph-using-data-from-mysql-mariadb-table-and-php
> github repo
> https://github.com/yusufshakeel/chartjs2
> tutorial video
> https://www.youtube.com/watch?v=nsnbv3wtW3g&index=5&list=PLG
> 6ePePp5vvZLVjT5mgyxBpkbNBpuAwq9
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#5 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/Aff4OPt9mZSZZ9HPOJbcOSjIrJbPZt6rks5svKAYgaJpZM4QCzC6>
> .
>
VidyaCK commented
In data.php file, in " $result = $mysqli->query($query);" line it is giving
undefined variable.
On Tue, Oct 24, 2017 at 10:58 AM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… Sir,How to solve this? I am not getting where it went wrong?
On Tue, Oct 24, 2017 at 10:30 AM, Vidya kabber ***@***.***>
wrote:
> When I execute the data.php file it is displaying like this.What goes
> wrong here.
>
> On Mon, Oct 23, 2017 at 7:48 PM, Yusuf Shakeel ***@***.***>
> wrote:
>
>> this repo is using older version of chartjs (v1.x) kindly check the new
>> repo chartjs2
>> hope this helps
>> code
>> https://www.dyclassroom.com/chartjs/chartjs-how-to-create-li
>> ne-graph-using-data-from-mysql-mariadb-table-and-php
>> github repo
>> https://github.com/yusufshakeel/chartjs2
>> tutorial video
>> https://www.youtube.com/watch?v=nsnbv3wtW3g&index=5&list=PLG
>> 6ePePp5vvZLVjT5mgyxBpkbNBpuAwq9
>>
>> —
>> You are receiving this because you authored the thread.
>> Reply to this email directly, view it on GitHub
>> <#5 (comment)>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/Aff4OPt9mZSZZ9HPOJbcOSjIrJbPZt6rks5svKAYgaJpZM4QCzC6>
>> .
>>
>
>
VidyaCK commented
It worked. Problem solved.
On Tue, Oct 24, 2017 at 11:33 AM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… In data.php file, in " $result = $mysqli->query($query);" line it is
giving undefined variable.
On Tue, Oct 24, 2017 at 10:58 AM, Vidya kabber ***@***.***>
wrote:
> Sir,How to solve this? I am not getting where it went wrong?
>
> On Tue, Oct 24, 2017 at 10:30 AM, Vidya kabber ***@***.***>
> wrote:
>
>> When I execute the data.php file it is displaying like this.What goes
>> wrong here.
>>
>> On Mon, Oct 23, 2017 at 7:48 PM, Yusuf Shakeel ***@***.***
>> > wrote:
>>
>>> this repo is using older version of chartjs (v1.x) kindly check the new
>>> repo chartjs2
>>> hope this helps
>>> code
>>> https://www.dyclassroom.com/chartjs/chartjs-how-to-create-li
>>> ne-graph-using-data-from-mysql-mariadb-table-and-php
>>> github repo
>>> https://github.com/yusufshakeel/chartjs2
>>> tutorial video
>>> https://www.youtube.com/watch?v=nsnbv3wtW3g&index=5&list=PLG
>>> 6ePePp5vvZLVjT5mgyxBpkbNBpuAwq9
>>>
>>> —
>>> You are receiving this because you authored the thread.
>>> Reply to this email directly, view it on GitHub
>>> <#5 (comment)>,
>>> or mute the thread
>>> <https://github.com/notifications/unsubscribe-auth/Aff4OPt9mZSZZ9HPOJbcOSjIrJbPZt6rks5svKAYgaJpZM4QCzC6>
>>> .
>>>
>>
>>
>
VidyaCK commented
Thank you so much sir for for help. It is working fine.
On Tue, Oct 24, 2017 at 12:10 PM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… It worked. Problem solved.
On Tue, Oct 24, 2017 at 11:33 AM, Vidya kabber ***@***.***>
wrote:
> In data.php file, in " $result = $mysqli->query($query);" line it is
> giving undefined variable.
>
> On Tue, Oct 24, 2017 at 10:58 AM, Vidya kabber ***@***.***>
> wrote:
>
>> Sir,How to solve this? I am not getting where it went wrong?
>>
>> On Tue, Oct 24, 2017 at 10:30 AM, Vidya kabber ***@***.***
>> > wrote:
>>
>>> When I execute the data.php file it is displaying like this.What goes
>>> wrong here.
>>>
>>> On Mon, Oct 23, 2017 at 7:48 PM, Yusuf Shakeel <
>>> ***@***.***> wrote:
>>>
>>>> this repo is using older version of chartjs (v1.x) kindly check the
>>>> new repo chartjs2
>>>> hope this helps
>>>> code
>>>> https://www.dyclassroom.com/chartjs/chartjs-how-to-create-li
>>>> ne-graph-using-data-from-mysql-mariadb-table-and-php
>>>> github repo
>>>> https://github.com/yusufshakeel/chartjs2
>>>> tutorial video
>>>> https://www.youtube.com/watch?v=nsnbv3wtW3g&index=5&list=PLG
>>>> 6ePePp5vvZLVjT5mgyxBpkbNBpuAwq9
>>>>
>>>> —
>>>> You are receiving this because you authored the thread.
>>>> Reply to this email directly, view it on GitHub
>>>> <#5 (comment)>,
>>>> or mute the thread
>>>> <https://github.com/notifications/unsubscribe-auth/Aff4OPt9mZSZZ9HPOJbcOSjIrJbPZt6rks5svKAYgaJpZM4QCzC6>
>>>> .
>>>>
>>>
>>>
>>
>
VidyaCK commented
Can you help me to solve this.
Sir, I have created other database. It is same as example database. Below I
have pasted that below,
[image: Inline image 1]
When I open the line-dp-php.html through browser, it display as below,
[image: Inline image 2]
In line-dp-php.js I have made these changes,
$(document).ready(function() {
/**
* call the data.php file to fetch the result from db table.
*/
$.ajax({
url : "http://localhost:81/chartjs3/api/data.php",
type : "GET",
success : function(data){
console.log(data);
var score = {
pass : [],
fail : []
};
var len = data.length;
for (var i = 0; i < len; i++) {
if (data[i].result == "pass") {
score.pass.push(data[i].score);
}
else if (data[i].result == "fail") {
score.fail.push(data[i].score);
}
}
//get canvas
var ctx = $("#line-chartcanvas");
var data = {
labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
datasets : [
{
label : "pass testcase",
data : score.pass,
backgroundColor : "green",
borderColor : "lightgreen",
fill : false,
lineTension : 0,
pointRadius : 5
},
{
label : "fail testcase",
data : score.fail,
backgroundColor : "red",
borderColor : "lightred",
fill : false,
lineTension : 0,
pointRadius : 5
}
]
};
var options = {
title : {
display : true,
position : "top",
text : "Line Graph",
fontSize : 18,
fontColor : "#111"
},
legend : {
display : true,
position : "bottom"
}
};
var chart = new Chart( ctx, {
type : "line",
data : data,
options : options
} );
},
error : function(data) {
console.log(data);
}
});
});
VidyaCK commented
Reply me.
…On Tue, Oct 24, 2017 at 7:43 PM, Vidya kabber ***@***.***> wrote:
Can you help me to solve this.
Sir, I have created other database. It is same as example database. Below
I have pasted that below,
[image: Inline image 1]
When I open the line-dp-php.html through browser, it display as below,
[image: Inline image 2]
In line-dp-php.js I have made these changes,
$(document).ready(function() {
/**
* call the data.php file to fetch the result from db table.
*/
$.ajax({
url : "http://localhost:81/chartjs3/api/data.php",
type : "GET",
success : function(data){
console.log(data);
var score = {
pass : [],
fail : []
};
var len = data.length;
for (var i = 0; i < len; i++) {
if (data[i].result == "pass") {
score.pass.push(data[i].score);
}
else if (data[i].result == "fail") {
score.fail.push(data[i].score);
}
}
//get canvas
var ctx = $("#line-chartcanvas");
var data = {
labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
datasets : [
{
label : "pass testcase",
data : score.pass,
backgroundColor : "green",
borderColor : "lightgreen",
fill : false,
lineTension : 0,
pointRadius : 5
},
{
label : "fail testcase",
data : score.fail,
backgroundColor : "red",
borderColor : "lightred",
fill : false,
lineTension : 0,
pointRadius : 5
}
]
};
var options = {
title : {
display : true,
position : "top",
text : "Line Graph",
fontSize : 18,
fontColor : "#111"
},
legend : {
display : true,
position : "bottom"
}
};
var chart = new Chart( ctx, {
type : "line",
data : data,
options : options
} );
},
error : function(data) {
console.log(data);
}
});
});
VidyaCK commented
Can you reply me soon?
On Wed, Oct 25, 2017 at 9:54 AM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… Reply me.
On Tue, Oct 24, 2017 at 7:43 PM, Vidya kabber ***@***.***>
wrote:
> Can you help me to solve this.
> Sir, I have created other database. It is same as example database. Below
> I have pasted that below,
>
> [image: Inline image 1]
>
>
>
> When I open the line-dp-php.html through browser, it display as below,
>
> [image: Inline image 2]
> In line-dp-php.js I have made these changes,
>
>
>
>
>
>
> $(document).ready(function() {
>
> /**
> * call the data.php file to fetch the result from db table.
> */
> $.ajax({
> url : "http://localhost:81/chartjs3/api/data.php",
> type : "GET",
> success : function(data){
> console.log(data);
>
> var score = {
> pass : [],
> fail : []
> };
>
> var len = data.length;
>
> for (var i = 0; i < len; i++) {
> if (data[i].result == "pass") {
> score.pass.push(data[i].score);
> }
> else if (data[i].result == "fail") {
> score.fail.push(data[i].score);
> }
> }
>
> //get canvas
> var ctx = $("#line-chartcanvas");
>
> var data = {
> labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
> datasets : [
> {
> label : "pass testcase",
> data : score.pass,
> backgroundColor : "green",
> borderColor : "lightgreen",
> fill : false,
> lineTension : 0,
> pointRadius : 5
> },
> {
> label : "fail testcase",
> data : score.fail,
> backgroundColor : "red",
> borderColor : "lightred",
> fill : false,
> lineTension : 0,
> pointRadius : 5
> }
> ]
> };
>
> var options = {
> title : {
> display : true,
> position : "top",
> text : "Line Graph",
> fontSize : 18,
> fontColor : "#111"
> },
> legend : {
> display : true,
> position : "bottom"
> }
> };
>
> var chart = new Chart( ctx, {
> type : "line",
> data : data,
> options : options
> } );
>
> },
> error : function(data) {
> console.log(data);
> }
> });
>
> });
>
VidyaCK commented
I am not getting where it went wrong?
On Wed, Oct 25, 2017 at 2:05 PM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… Can you reply me soon?
On Wed, Oct 25, 2017 at 9:54 AM, Vidya kabber ***@***.***>
wrote:
> Reply me.
>
> On Tue, Oct 24, 2017 at 7:43 PM, Vidya kabber ***@***.***>
> wrote:
>
>> Can you help me to solve this.
>> Sir, I have created other database. It is same as example database.
>> Below I have pasted that below,
>>
>> [image: Inline image 1]
>>
>>
>>
>> When I open the line-dp-php.html through browser, it display as below,
>>
>> [image: Inline image 2]
>> In line-dp-php.js I have made these changes,
>>
>>
>>
>>
>>
>>
>> $(document).ready(function() {
>>
>> /**
>> * call the data.php file to fetch the result from db table.
>> */
>> $.ajax({
>> url : "http://localhost:81/chartjs3/api/data.php",
>> type : "GET",
>> success : function(data){
>> console.log(data);
>>
>> var score = {
>> pass : [],
>> fail : []
>> };
>>
>> var len = data.length;
>>
>> for (var i = 0; i < len; i++) {
>> if (data[i].result == "pass") {
>> score.pass.push(data[i].score);
>> }
>> else if (data[i].result == "fail") {
>> score.fail.push(data[i].score);
>> }
>> }
>>
>> //get canvas
>> var ctx = $("#line-chartcanvas");
>>
>> var data = {
>> labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
>> datasets : [
>> {
>> label : "pass testcase",
>> data : score.pass,
>> backgroundColor : "green",
>> borderColor : "lightgreen",
>> fill : false,
>> lineTension : 0,
>> pointRadius : 5
>> },
>> {
>> label : "fail testcase",
>> data : score.fail,
>> backgroundColor : "red",
>> borderColor : "lightred",
>> fill : false,
>> lineTension : 0,
>> pointRadius : 5
>> }
>> ]
>> };
>>
>> var options = {
>> title : {
>> display : true,
>> position : "top",
>> text : "Line Graph",
>> fontSize : 18,
>> fontColor : "#111"
>> },
>> legend : {
>> display : true,
>> position : "bottom"
>> }
>> };
>>
>> var chart = new Chart( ctx, {
>> type : "line",
>> data : data,
>> options : options
>> } );
>>
>> },
>> error : function(data) {
>> console.log(data);
>> }
>> });
>>
>> });
>>
>
>
VidyaCK commented
Here I have score to no_tc.
On Wed, Oct 25, 2017 at 2:10 PM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… I am not getting where it went wrong?
On Wed, Oct 25, 2017 at 2:05 PM, Vidya kabber ***@***.***>
wrote:
> Can you reply me soon?
>
> On Wed, Oct 25, 2017 at 9:54 AM, Vidya kabber ***@***.***>
> wrote:
>
>> Reply me.
>>
>> On Tue, Oct 24, 2017 at 7:43 PM, Vidya kabber ***@***.***>
>> wrote:
>>
>>> Can you help me to solve this.
>>> Sir, I have created other database. It is same as example database.
>>> Below I have pasted that below,
>>>
>>> [image: Inline image 1]
>>>
>>>
>>>
>>> When I open the line-dp-php.html through browser, it display as below,
>>>
>>> [image: Inline image 2]
>>> In line-dp-php.js I have made these changes,
>>>
>>>
>>>
>>>
>>>
>>>
>>> $(document).ready(function() {
>>>
>>> /**
>>> * call the data.php file to fetch the result from db table.
>>> */
>>> $.ajax({
>>> url : "http://localhost:81/chartjs3/api/data.php",
>>> type : "GET",
>>> success : function(data){
>>> console.log(data);
>>>
>>> var score = {
>>> pass : [],
>>> fail : []
>>> };
>>>
>>> var len = data.length;
>>>
>>> for (var i = 0; i < len; i++) {
>>> if (data[i].result == "pass") {
>>> score.pass.push(data[i].score);
>>> }
>>> else if (data[i].result == "fail") {
>>> score.fail.push(data[i].score);
>>> }
>>> }
>>>
>>> //get canvas
>>> var ctx = $("#line-chartcanvas");
>>>
>>> var data = {
>>> labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
>>> datasets : [
>>> {
>>> label : "pass testcase",
>>> data : score.pass,
>>> backgroundColor : "green",
>>> borderColor : "lightgreen",
>>> fill : false,
>>> lineTension : 0,
>>> pointRadius : 5
>>> },
>>> {
>>> label : "fail testcase",
>>> data : score.fail,
>>> backgroundColor : "red",
>>> borderColor : "lightred",
>>> fill : false,
>>> lineTension : 0,
>>> pointRadius : 5
>>> }
>>> ]
>>> };
>>>
>>> var options = {
>>> title : {
>>> display : true,
>>> position : "top",
>>> text : "Line Graph",
>>> fontSize : 18,
>>> fontColor : "#111"
>>> },
>>> legend : {
>>> display : true,
>>> position : "bottom"
>>> }
>>> };
>>>
>>> var chart = new Chart( ctx, {
>>> type : "line",
>>> data : data,
>>> options : options
>>> } );
>>>
>>> },
>>> error : function(data) {
>>> console.log(data);
>>> }
>>> });
>>>
>>> });
>>>
>>
>>
>
VidyaCK commented
what is data in that? I didn't get that.
On Wed, Oct 25, 2017 at 4:09 PM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… Here I have score to no_tc.
On Wed, Oct 25, 2017 at 2:10 PM, Vidya kabber ***@***.***>
wrote:
> I am not getting where it went wrong?
>
> On Wed, Oct 25, 2017 at 2:05 PM, Vidya kabber ***@***.***>
> wrote:
>
>> Can you reply me soon?
>>
>> On Wed, Oct 25, 2017 at 9:54 AM, Vidya kabber ***@***.***>
>> wrote:
>>
>>> Reply me.
>>>
>>> On Tue, Oct 24, 2017 at 7:43 PM, Vidya kabber ***@***.***
>>> > wrote:
>>>
>>>> Can you help me to solve this.
>>>> Sir, I have created other database. It is same as example database.
>>>> Below I have pasted that below,
>>>>
>>>> [image: Inline image 1]
>>>>
>>>>
>>>>
>>>> When I open the line-dp-php.html through browser, it display as
>>>> below,
>>>>
>>>> [image: Inline image 2]
>>>> In line-dp-php.js I have made these changes,
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> $(document).ready(function() {
>>>>
>>>> /**
>>>> * call the data.php file to fetch the result from db table.
>>>> */
>>>> $.ajax({
>>>> url : "http://localhost:81/chartjs3/api/data.php",
>>>> type : "GET",
>>>> success : function(data){
>>>> console.log(data);
>>>>
>>>> var score = {
>>>> pass : [],
>>>> fail : []
>>>> };
>>>>
>>>> var len = data.length;
>>>>
>>>> for (var i = 0; i < len; i++) {
>>>> if (data[i].result == "pass") {
>>>> score.pass.push(data[i].score);
>>>> }
>>>> else if (data[i].result == "fail") {
>>>> score.fail.push(data[i].score);
>>>> }
>>>> }
>>>>
>>>> //get canvas
>>>> var ctx = $("#line-chartcanvas");
>>>>
>>>> var data = {
>>>> labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
>>>> datasets : [
>>>> {
>>>> label : "pass testcase",
>>>> data : score.pass,
>>>> backgroundColor : "green",
>>>> borderColor : "lightgreen",
>>>> fill : false,
>>>> lineTension : 0,
>>>> pointRadius : 5
>>>> },
>>>> {
>>>> label : "fail testcase",
>>>> data : score.fail,
>>>> backgroundColor : "red",
>>>> borderColor : "lightred",
>>>> fill : false,
>>>> lineTension : 0,
>>>> pointRadius : 5
>>>> }
>>>> ]
>>>> };
>>>>
>>>> var options = {
>>>> title : {
>>>> display : true,
>>>> position : "top",
>>>> text : "Line Graph",
>>>> fontSize : 18,
>>>> fontColor : "#111"
>>>> },
>>>> legend : {
>>>> display : true,
>>>> position : "bottom"
>>>> }
>>>> };
>>>>
>>>> var chart = new Chart( ctx, {
>>>> type : "line",
>>>> data : data,
>>>> options : options
>>>> } );
>>>>
>>>> },
>>>> error : function(data) {
>>>> console.log(data);
>>>> }
>>>> });
>>>>
>>>> });
>>>>
>>>
>>>
>>
>
VidyaCK commented
Replay me, sir.
On Wed, Oct 25, 2017 at 4:18 PM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… what is data in that? I didn't get that.
On Wed, Oct 25, 2017 at 4:09 PM, Vidya kabber ***@***.***>
wrote:
> Here I have score to no_tc.
>
> On Wed, Oct 25, 2017 at 2:10 PM, Vidya kabber ***@***.***>
> wrote:
>
>> I am not getting where it went wrong?
>>
>> On Wed, Oct 25, 2017 at 2:05 PM, Vidya kabber ***@***.***>
>> wrote:
>>
>>> Can you reply me soon?
>>>
>>> On Wed, Oct 25, 2017 at 9:54 AM, Vidya kabber ***@***.***
>>> > wrote:
>>>
>>>> Reply me.
>>>>
>>>> On Tue, Oct 24, 2017 at 7:43 PM, Vidya kabber <
>>>> ***@***.***> wrote:
>>>>
>>>>> Can you help me to solve this.
>>>>> Sir, I have created other database. It is same as example database.
>>>>> Below I have pasted that below,
>>>>>
>>>>> [image: Inline image 1]
>>>>>
>>>>>
>>>>>
>>>>> When I open the line-dp-php.html through browser, it display as
>>>>> below,
>>>>>
>>>>> [image: Inline image 2]
>>>>> In line-dp-php.js I have made these changes,
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> $(document).ready(function() {
>>>>>
>>>>> /**
>>>>> * call the data.php file to fetch the result from db table.
>>>>> */
>>>>> $.ajax({
>>>>> url : "http://localhost:81/chartjs3/api/data.php",
>>>>> type : "GET",
>>>>> success : function(data){
>>>>> console.log(data);
>>>>>
>>>>> var score = {
>>>>> pass : [],
>>>>> fail : []
>>>>> };
>>>>>
>>>>> var len = data.length;
>>>>>
>>>>> for (var i = 0; i < len; i++) {
>>>>> if (data[i].result == "pass") {
>>>>> score.pass.push(data[i].score);
>>>>> }
>>>>> else if (data[i].result == "fail") {
>>>>> score.fail.push(data[i].score);
>>>>> }
>>>>> }
>>>>>
>>>>> //get canvas
>>>>> var ctx = $("#line-chartcanvas");
>>>>>
>>>>> var data = {
>>>>> labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
>>>>> datasets : [
>>>>> {
>>>>> label : "pass testcase",
>>>>> data : score.pass,
>>>>> backgroundColor : "green",
>>>>> borderColor : "lightgreen",
>>>>> fill : false,
>>>>> lineTension : 0,
>>>>> pointRadius : 5
>>>>> },
>>>>> {
>>>>> label : "fail testcase",
>>>>> data : score.fail,
>>>>> backgroundColor : "red",
>>>>> borderColor : "lightred",
>>>>> fill : false,
>>>>> lineTension : 0,
>>>>> pointRadius : 5
>>>>> }
>>>>> ]
>>>>> };
>>>>>
>>>>> var options = {
>>>>> title : {
>>>>> display : true,
>>>>> position : "top",
>>>>> text : "Line Graph",
>>>>> fontSize : 18,
>>>>> fontColor : "#111"
>>>>> },
>>>>> legend : {
>>>>> display : true,
>>>>> position : "bottom"
>>>>> }
>>>>> };
>>>>>
>>>>> var chart = new Chart( ctx, {
>>>>> type : "line",
>>>>> data : data,
>>>>> options : options
>>>>> } );
>>>>>
>>>>> },
>>>>> error : function(data) {
>>>>> console.log(data);
>>>>> }
>>>>> });
>>>>>
>>>>> });
>>>>>
>>>>
>>>>
>>>
>>
>
VidyaCK commented
It is working fine. Thank you sir.
On Wed, Oct 25, 2017 at 7:35 PM, Vidya kabber <vidya.merahkee@gmail.com>
wrote:
… Replay me, sir.
On Wed, Oct 25, 2017 at 4:18 PM, Vidya kabber ***@***.***>
wrote:
> what is data in that? I didn't get that.
>
> On Wed, Oct 25, 2017 at 4:09 PM, Vidya kabber ***@***.***>
> wrote:
>
>> Here I have score to no_tc.
>>
>> On Wed, Oct 25, 2017 at 2:10 PM, Vidya kabber ***@***.***>
>> wrote:
>>
>>> I am not getting where it went wrong?
>>>
>>> On Wed, Oct 25, 2017 at 2:05 PM, Vidya kabber ***@***.***
>>> > wrote:
>>>
>>>> Can you reply me soon?
>>>>
>>>> On Wed, Oct 25, 2017 at 9:54 AM, Vidya kabber <
>>>> ***@***.***> wrote:
>>>>
>>>>> Reply me.
>>>>>
>>>>> On Tue, Oct 24, 2017 at 7:43 PM, Vidya kabber <
>>>>> ***@***.***> wrote:
>>>>>
>>>>>> Can you help me to solve this.
>>>>>> Sir, I have created other database. It is same as example database.
>>>>>> Below I have pasted that below,
>>>>>>
>>>>>> [image: Inline image 1]
>>>>>>
>>>>>>
>>>>>>
>>>>>> When I open the line-dp-php.html through browser, it display as
>>>>>> below,
>>>>>>
>>>>>> [image: Inline image 2]
>>>>>> In line-dp-php.js I have made these changes,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> $(document).ready(function() {
>>>>>>
>>>>>> /**
>>>>>> * call the data.php file to fetch the result from db table.
>>>>>> */
>>>>>> $.ajax({
>>>>>> url : "http://localhost:81/chartjs3/api/data.php",
>>>>>> type : "GET",
>>>>>> success : function(data){
>>>>>> console.log(data);
>>>>>>
>>>>>> var score = {
>>>>>> pass : [],
>>>>>> fail : []
>>>>>> };
>>>>>>
>>>>>> var len = data.length;
>>>>>>
>>>>>> for (var i = 0; i < len; i++) {
>>>>>> if (data[i].result == "pass") {
>>>>>> score.pass.push(data[i].score);
>>>>>> }
>>>>>> else if (data[i].result == "fail") {
>>>>>> score.fail.push(data[i].score);
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> //get canvas
>>>>>> var ctx = $("#line-chartcanvas");
>>>>>>
>>>>>> var data = {
>>>>>> labels : ["ver1", "ver2", "ver3", "ver4", "ver5"],
>>>>>> datasets : [
>>>>>> {
>>>>>> label : "pass testcase",
>>>>>> data : score.pass,
>>>>>> backgroundColor : "green",
>>>>>> borderColor : "lightgreen",
>>>>>> fill : false,
>>>>>> lineTension : 0,
>>>>>> pointRadius : 5
>>>>>> },
>>>>>> {
>>>>>> label : "fail testcase",
>>>>>> data : score.fail,
>>>>>> backgroundColor : "red",
>>>>>> borderColor : "lightred",
>>>>>> fill : false,
>>>>>> lineTension : 0,
>>>>>> pointRadius : 5
>>>>>> }
>>>>>> ]
>>>>>> };
>>>>>>
>>>>>> var options = {
>>>>>> title : {
>>>>>> display : true,
>>>>>> position : "top",
>>>>>> text : "Line Graph",
>>>>>> fontSize : 18,
>>>>>> fontColor : "#111"
>>>>>> },
>>>>>> legend : {
>>>>>> display : true,
>>>>>> position : "bottom"
>>>>>> }
>>>>>> };
>>>>>>
>>>>>> var chart = new Chart( ctx, {
>>>>>> type : "line",
>>>>>> data : data,
>>>>>> options : options
>>>>>> } );
>>>>>>
>>>>>> },
>>>>>> error : function(data) {
>>>>>> console.log(data);
>>>>>> }
>>>>>> });
>>>>>>
>>>>>> });
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
VidyaCK commented
For bar graph how to take the values from database.