谷歌图表API:显示数据点(PHP+;MySQL)

谷歌图表API:显示数据点(PHP+;MySQL),php,javascript,Php,Javascript,我遇到了这个线程,这正是我想要的,但这里给出的答案适用于使用硬编码值的情况 在我的例子中,我使用MySQL数据填充图表,因此无法确定在何处以及如何准确使用role:annonation属性。我使用下面的代码来绘制图表 PHP Javascript google.load('visualization','1',{'packages':['corechart']}); setOnLoadCallback(drawChart); 函数绘图图(){ var data=new google.visual

我遇到了这个线程,这正是我想要的,但这里给出的答案适用于使用硬编码值的情况

在我的例子中,我使用MySQL数据填充图表,因此无法确定在何处以及如何准确使用
role:annonation
属性。我使用下面的代码来绘制图表

PHP Javascript
google.load('visualization','1',{'packages':['corechart']});
setOnLoadCallback(drawChart);
函数绘图图(){
var data=new google.visualization.DataTable();
变量选项={
title:'TNS',titleTextStyle:{color:'green'},hAxis:{title:'MONTH',titleTextStyle:{color:'green'},vAxis:{title:'Percentage',titleTextStyle:{color:'green'},viewWindowMode:'explicit',
视图窗口:{
最高:110,
最低:0
}},
is3D:'正确',
身高:600,
颜色:[“黑色”、“红色”、“绿色”、“蓝色”、“黄色”]
};
var chart=new google.visualization.LineChart(document.getElementById('tns1');
图表绘制(数据、选项);
}

我自己想出来的。我所要做的就是在选项中添加以下内容:

pointSize: 10
这样我的配置选项就变成了

var options = {
          title: 'TNS',titleTextStyle: {color: "green"}, hAxis: {title: "MONTH", titleTextStyle: {color: "green"}}, vAxis: {title: "Percentage", titleTextStyle: {color: "green"},viewWindowMode: 'explicit',
          viewWindow: {
             max: 110,
             min: 0
          }},
          pointSize: 10, // <----- this is what did the trick
          is3D: 'true',
          height:600,
          colors: ['black', 'red', 'green', 'blue', 'yellow']         
};
var选项={
title:'TNS',titleTextStyle:{color:'green'},hAxis:{title:'MONTH',titleTextStyle:{color:'green'},vAxis:{title:'Percentage',titleTextStyle:{color:'green'},viewWindowMode:'explicit',
视图窗口:{
最高:110,
最低:0
}},

pointSize:10,//这应该标记为“Javascript”和“Google Graph Api”,而不是PHP,或者您在用数据填充表时遇到问题吗?不。用数据填充表不是问题。我将其标记为PHP,因为我认为该代码可能也适用于任何PHP代码。
pointSize: 10
var options = {
          title: 'TNS',titleTextStyle: {color: "green"}, hAxis: {title: "MONTH", titleTextStyle: {color: "green"}}, vAxis: {title: "Percentage", titleTextStyle: {color: "green"},viewWindowMode: 'explicit',
          viewWindow: {
             max: 110,
             min: 0
          }},
          pointSize: 10, // <----- this is what did the trick
          is3D: 'true',
          height:600,
          colors: ['black', 'red', 'green', 'blue', 'yellow']         
};