小白求大神帮忙解释chart的问题
javascript吧
全部回复
仅看楼主
level 12
var myNewChart = new Chart(ctx).PolarArea(data);
new Chart(ctx).PolarArea(data,options);
这代码什么意思,我把他注释掉就可以显示图片,不注释就不会显示
HTML代码
<!doctype html>
<html>
<head>
<title>Chart.js折线图DEMO演示</title>
<script src="../Chart.js"></script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<meta charset="UTF-8">
<style>
canvas{
}
</style>
</head>
<body>
<canvas id="myChart" width="400" height="400"></canvas>
<div style="text-align:center;clear:both;">
</div>
<script src="chartjstest.js"></script>
<script>
//var myLine = new Chart(document.getElementById("myChart").getContext("2d")).Line(data);
</script>
</body>
</html>
JS代码
var ctx = document.getElementById("myChart").getContext("2d");
var data = {
labels : ["January","February","March","April","May","June","July"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,1)",
pointColor : "rgba(220,220,220,1)",
pointStrokeColor : "#fff",
data : [65,59,90,81,56,55,40]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,1)",
pointColor : "rgba(151,187,205,1)",
pointStrokeColor : "#fff",
data : [28,48,40,19,96,27,100]
}
]
}
//var myNewChart = new Chart(ctx).PolarArea(data);
options = {
//Boolean - If we show the scale above the chart data
scaleOverlay : false,
//Boolean - If we want to override with a hard coded scale
scaleOverride : false,
//** Required if scaleOverride is true **
//Number - The number of steps in a hard coded scale
scaleSteps : null,
//Number - The value jump in the hard coded scale
scaleStepWidth : null,
//Number - The scale starting value
scaleStartValue : null,
//String - Colour of the scale line
scaleLineColor : "rgba(0,0,0,.1)",
//Number - Pixel width of the scale line
scaleLineWidth : 1,
//Boolean - Whether to show labels on the scale
scaleShowLabels : false,
//Interpolated JS string - can access value
scaleLabel : "<%=value%>",
//String - Scale label font declaration for the scale label
scaleFontFamily : "'Arial'",
//Number - Scale label font size in pixels
scaleFontSize : 12,
//String - Scale label font weight style
scaleFontStyle : "normal",
//String - Scale label font colour
scaleFontColor : "#666",
///Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : "rgba(0,0,0,.05)",
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether the line is curved between points
bezierCurve : true,
//Boolean - Whether to show a dot for each point
pointDot : true,
//Number - Radius of each point dot in pixels
pointDotRadius : 3,
//Number - Pixel width of point dot stroke
pointDotStrokeWidth : 1,
//Boolean - Whether to show a stroke for datasets
datasetStroke : true,
//Number - Pixel width of dataset stroke
datasetStrokeWidth : 2,
//Boolean - Whether to fill the dataset with a colour
datasetFill : true,
//Boolean - Whether to animate the chart
animation : true,
//Number - Number of animation steps
animationSteps : 60,
//String - Animation easing effect
animationEasing : "easeOutQuart",
//Function - Fires when the animation is complete
onAnimationComplete : null
}
//new Chart(ctx).PolarArea(data,options);
new Chart(ctx).Line(data,options);
还想问问那个options那里面是什么意思啊
2015年05月17日 09点05分 1
level 12
求大神帮忙[泪]看了好几个点了我都没搞明白!!能有师傅带我装逼带我飞么
2015年05月17日 09点05分 2
level 1
兄弟,你明白了吧,给我说说呗
2016年07月29日 11点07分 3
1