Chart.js学习

一、简介

  Chart.js是一个基于HTML5的简单的面向对象的图表库,支持包括IE78的所有现代浏览器。图表库中有6种表,分别是:曲线图(Linecharts)、柱状图(Barcharts)、雷达图(Radarcharts)、饼状图(Piecharts)、极坐标区域图(Polararea charts)以及圆环图(Doughnutcharts)。并且带有动画效果(animated),支持retina

二、开始学习

①,首先Chart.js的官网地址是:http://www.chartjs.org/,可以从官网上下载JS文件。

然后加入到html文件中。

1 <script src="Chart.js" ></script>

②,曲线图(Line charts)

曲线图适合于表示数据的趋势变化,以及数据之间的对比。

测试代码如下:

  1 <html>
  2     <head>
  3         <title>TestChart.js</title>
  4         <script src="Chart.js" ></script>
  5     </head>
  6     <body>
  7         <canvas id="myChart" width="400" height="400"></canvas>
  8         <script type="text/javascript">
  9             var ctx = document.getElementById("myChart").getContext("2d");
 10             var data = {
 11                 /// 表现在X轴上的数据,数组形式
 12                 labels : ["January","February","March","April","May","June","July"],
 13                 /// 第一条线
 14                 datasets : [
 15                 {
 16                     /// 曲线的填充颜色
 17                     fillColor : "rgba(220,220,220,0.5)",
 18                     /// 填充块的边框线的颜色
 19                     strokeColor : "rgba(220,220,220,1)",
 20                     /// 表示数据的圆圈的颜色
 21                     pointColor : "rgba(220,220,220,1)",
 22                     /// 表示数据的圆圈的边的颜色
 23                     pointStrokeColor : "#fff",
 24                     data : [65,59,90,81,56,55,40]
 25                 },
 26                 /// 第二条线
 27                 {
 28                     fillColor : "rgba(151,187,205,0.5)",
 29                     strokeColor : "rgba(151,187,205,1)",
 30                     pointColor : "rgba(151,187,205,1)",
 31                     pointStrokeColor : "#fff",
 32                     data : [28,48,40,19,96,27,100]
 33                 }
 34                 ]
 35             }
 36             /// 动画效果
 37             var options = {
 38                 
 39                 //Boolean - If we show the scale above the chart data            
 40                 scaleOverlay : false,
 41     
 42                 //Boolean - If we want to override with a hard coded scale
 43                 scaleOverride : false,
 44     
 45                 //** Required if scaleOverride is true **
 46                 //Number - The number of steps in a hard coded scale
 47                 scaleSteps : null,
 48                 //Number - The value jump in the hard coded scale
 49                 scaleStepWidth : null,
 50                 //Number - The scale starting value
 51                 scaleStartValue : null,
 52 
 53                 //String - Colour of the scale line    
 54                 scaleLineColor : "rgba(0,0,0,.1)",
 55     
 56                 //Number - Pixel width of the scale line    
 57                 scaleLineWidth : 1,
 58 
 59                 //Boolean - Whether to show labels on the scale    
 60                 scaleShowLabels : true,
 61     
 62                 //Interpolated JS string - can access value
 63                 scaleLabel : "<%=value%>",
 64     
 65                 //String - Scale label font declaration for the scale label
 66                 scaleFontFamily : "'Arial'",
 67     
 68                 //Number - Scale label font size in pixels    
 69                 scaleFontSize : 12,
 70     
 71                 //String - Scale label font weight style    
 72                 scaleFontStyle : "normal",
 73     
 74                 //String - Scale label font colour    
 75                 scaleFontColor : "#666",    
 76     
 77                 ///Boolean - Whether grid lines are shown across the chart
 78                 scaleShowGridLines : true,
 79                 
 80                 //String - Colour of the grid lines
 81                 scaleGridLineColor : "rgba(0,0,0,.05)",
 82     
 83                 //Number - Width of the grid lines
 84                 scaleGridLineWidth : 1,    
 85     
 86                 //Boolean - Whether the line is curved between points
 87                 bezierCurve : true,
 88     
 89                 //Boolean - Whether to show a dot for each point
 90                 pointDot : true,
 91     
 92                 //Number - Radius of each point dot in pixels
 93                 pointDotRadius : 3,
 94     
 95                 //Number - Pixel width of point dot stroke
 96                 pointDotStrokeWidth : 1,
 97     
 98                 //Boolean - Whether to show a stroke for datasets
 99                 datasetStroke : true,
100     
101                 //Number - Pixel width of dataset stroke
102                 datasetStrokeWidth : 2,
103     
104                 //Boolean - Whether to fill the dataset with a colour
105                 datasetFill : true,
106     
107                 //Boolean - Whether to animate the chart
108                 animation : true,
109 
110                 //Number - Number of animation steps
111                 animationSteps : 60,
112     
113                 //String - Animation easing effect
114                 animationEasing : "easeOutQuart",
115 
116                 //Function - Fires when the animation is complete
117                 onAnimationComplete : null
118     
119             }
120             /// 创建对象,生成图表
121             new Chart(ctx).Line(data,options);
122         </script>
123     </body>
124 </html>

效果如下:

③,柱状图(Barcharts)

代码如下:

  1 <html>
  2     <head>
  3         <title>TestChart.js</title>
  4         <script src="Chart.js" ></script>
  5     </head>
  6     <body>
  7         <canvas id="myChart" width="400" height="400"></canvas>
  8         <script type="text/javascript">
  9             var ctx = document.getElementById("myChart").getContext("2d");
 10             var data = {
 11                 /// 表现在X轴上的数据,数组形式
 12                 labels : ["January","February","March","April","May","June","July"],
 13                 /// 第一条线
 14                 datasets : [
 15                 {
 16                     /// 填充颜色
 17                     fillColor : "red",
 18                     /// 填充块的边框线的颜色
 19                     strokeColor : "yellow",
 20                     data : [65,59,90,81,56,55,40]
 21                 },
 22                 /// 第二条线
 23                 {
 24                     fillColor : "blue",
 25                     strokeColor : "green",
 26                     data : [28,48,40,19,96,27,100]
 27                 }
 28                 ]
 29             }
 30             /// 动画效果
 31             var options = {
 32                 
 33                 //Boolean - If we show the scale above the chart data            
 34                 scaleOverlay : false,
 35     
 36                 //Boolean - If we want to override with a hard coded scale
 37                 scaleOverride : false,
 38     
 39                 //** Required if scaleOverride is true **
 40                 //Number - The number of steps in a hard coded scale
 41                 scaleSteps : null,
 42                 //Number - The value jump in the hard coded scale
 43                 scaleStepWidth : null,
 44                 //Number - The scale starting value
 45                 scaleStartValue : null,
 46 
 47                 //String - Colour of the scale line    
 48                 scaleLineColor : "rgba(0,0,0,.1)",
 49     
 50                 //Number - Pixel width of the scale line    
 51                 scaleLineWidth : 1,
 52 
 53                 //Boolean - Whether to show labels on the scale    
 54                 scaleShowLabels : true,
 55     
 56                 //Interpolated JS string - can access value
 57                 scaleLabel : "<%=value%>",
 58     
 59                 //String - Scale label font declaration for the scale label
 60                 scaleFontFamily : "'Arial'",
 61     
 62                 //Number - Scale label font size in pixels    
 63                 scaleFontSize : 12,
 64     
 65                 //String - Scale label font weight style    
 66                 scaleFontStyle : "normal",
 67     
 68                 //String - Scale label font colour    
 69                 scaleFontColor : "#666",    
 70     
 71                 ///Boolean - Whether grid lines are shown across the chart
 72                 scaleShowGridLines : true,
 73                 
 74                 //String - Colour of the grid lines
 75                 scaleGridLineColor : "rgba(0,0,0,.05)",
 76     
 77                 //Number - Width of the grid lines
 78                 scaleGridLineWidth : 1,    
 79     
 80                 //Boolean - Whether the line is curved between points
 81                 bezierCurve : true,
 82     
 83                 //Boolean - Whether to show a dot for each point
 84                 pointDot : true,
 85     
 86                 //Number - Radius of each point dot in pixels
 87                 pointDotRadius : 3,
 88     
 89                 //Number - Pixel width of point dot stroke
 90                 pointDotStrokeWidth : 1,
 91     
 92                 //Boolean - Whether to show a stroke for datasets
 93                 datasetStroke : true,
 94     
 95                 //Number - Pixel width of dataset stroke
 96                 datasetStrokeWidth : 2,
 97     
 98                 //Boolean - Whether to fill the dataset with a colour
 99                 datasetFill : true,
100     
101                 //Boolean - Whether to animate the chart
102                 animation : true,
103 
104                 //Number - Number of animation steps
105                 animationSteps : 60,
106     
107                 //String - Animation easing effect
108                 animationEasing : "easeOutQuart",
109 
110                 //Function - Fires when the animation is complete
111                 onAnimationComplete : null
112     
113             }
114             /// 创建对象,生成图表
115             new Chart(ctx).Bar(data,options);
116         </script>
117     </body>
118 </html>
119             

效果如下:

④,雷达图(Radar charts)

 代码如下:

  1 <html>
  2     <head>
  3         <title>TestChart.js</title>
  4         <script src="Chart.js" ></script>
  5     </head>
  6     <body>
  7         <canvas id="myChart" width="400" height="400"></canvas>
  8         <script type="text/javascript">
  9             var ctx = document.getElementById("myChart").getContext("2d");
 10             var data = {
 11                     labels : ["Eating","Drinking","Sleeping","Designing","Coding","Partying","Running"],
 12                     datasets : [
 13                         {
 14                             fillColor : "rgba(220,220,220,0.5)",
 15                             strokeColor : "rgba(220,220,220,1)",
 16                             pointColor : "rgba(220,220,220,1)",
 17                             pointStrokeColor : "#fff",
 18                             data : [65,59,90,81,56,55,40]
 19                         },
 20                         {
 21                             fillColor : "rgba(151,187,205,0.5)",
 22                             strokeColor : "rgba(151,187,205,1)",
 23                             pointColor : "rgba(151,187,205,1)",
 24                             pointStrokeColor : "#fff",
 25                             data : [28,48,40,19,96,27,100]
 26                         }
 27                     ]
 28             }
 29             /// 动画效果
 30             var options = {
 31                 
 32     //Boolean - If we show the scale above the chart data            
 33     scaleOverlay : false,
 34     
 35     //Boolean - If we want to override with a hard coded scale
 36     scaleOverride : false,
 37     
 38     //** Required if scaleOverride is true **
 39     //Number - The number of steps in a hard coded scale
 40     scaleSteps : null,
 41     //Number - The value jump in the hard coded scale
 42     scaleStepWidth : null,
 43     //Number - The centre starting value
 44     scaleStartValue : null,
 45     
 46     //Boolean - Whether to show lines for each scale point
 47     scaleShowLine : true,
 48 
 49     //String - Colour of the scale line    
 50     scaleLineColor : "rgba(0,0,0,.1)",
 51     
 52     //Number - Pixel width of the scale line    
 53     scaleLineWidth : 1,
 54 
 55     //Boolean - Whether to show labels on the scale    
 56     scaleShowLabels : false,
 57     
 58     //Interpolated JS string - can access value
 59     scaleLabel : "<%=value%>",
 60     
 61     //String - Scale label font declaration for the scale label
 62     scaleFontFamily : "'Arial'",
 63     
 64     //Number - Scale label font size in pixels    
 65     scaleFontSize : 12,
 66     
 67     //String - Scale label font weight style    
 68     scaleFontStyle : "normal",
 69     
 70     //String - Scale label font colour    
 71     scaleFontColor : "#666",
 72     
 73     //Boolean - Show a backdrop to the scale label
 74     scaleShowLabelBackdrop : true,
 75     
 76     //String - The colour of the label backdrop    
 77     scaleBackdropColor : "rgba(255,255,255,0.75)",
 78     
 79     //Number - The backdrop padding above & below the label in pixels
 80     scaleBackdropPaddingY : 2,
 81     
 82     //Number - The backdrop padding to the side of the label in pixels    
 83     scaleBackdropPaddingX : 2,
 84     
 85     //Boolean - Whether we show the angle lines out of the radar
 86     angleShowLineOut : true,
 87     
 88     //String - Colour of the angle line
 89     angleLineColor : "rgba(0,0,0,.1)",
 90     
 91     //Number - Pixel width of the angle line
 92     angleLineWidth : 1,            
 93     
 94     //String - Point label font declaration
 95     pointLabelFontFamily : "'Arial'",
 96     
 97     //String - Point label font weight
 98     pointLabelFontStyle : "normal",
 99     
100     //Number - Point label font size in pixels    
101     pointLabelFontSize : 12,
102     
103     //String - Point label font colour    
104     pointLabelFontColor : "#666",
105     
106     //Boolean - Whether to show a dot for each point
107     pointDot : true,
108     
109     //Number - Radius of each point dot in pixels
110     pointDotRadius : 3,
111     
112     //Number - Pixel width of point dot stroke
113     pointDotStrokeWidth : 1,
114     
115     //Boolean - Whether to show a stroke for datasets
116     datasetStroke : true,
117     
118     //Number - Pixel width of dataset stroke
119     datasetStrokeWidth : 2,
120     
121     //Boolean - Whether to fill the dataset with a colour
122     datasetFill : true,
123     
124     //Boolean - Whether to animate the chart
125     animation : true,
126 
127     //Number - Number of animation steps
128     animationSteps : 60,
129     
130     //String - Animation easing effect
131     animationEasing : "easeOutQuart",
132 
133     //Function - Fires when the animation is complete
134     onAnimationComplete : null
135     
136 }
137             /// 创建对象,生成图表
138             new Chart(ctx).Radar(data,options);
139         </script>
140     </body>
141 </html>
142             

效果如下:

⑤,饼状图(Piecharts)

代码如下:

 1 <html>
 2     <head>
 3         <title>TestChart.js</title>
 4         <script src="Chart.js" ></script>
 5     </head>
 6     <body>
 7         <canvas id="myChart" width="400" height="400"></canvas>
 8         <script type="text/javascript">
 9             var ctx = document.getElementById("myChart").getContext("2d");
10             var data = [
11     {
12         value: 30,
13         color:"#F38630"
14     },
15     {
16         value : 50,
17         color : "#E0E4CC"
18     },
19     {
20         value : 100,
21         color : "#69D2E7"
22     }            
23 ]
24             /// 动画效果
25             var options = {
26     //Boolean - Whether we should show a stroke on each segment
27     segmentShowStroke : true,
28     
29     //String - The colour of each segment stroke
30     segmentStrokeColor : "#fff",
31     
32     //Number - The width of each segment stroke
33     segmentStrokeWidth : 2,
34     
35     //Boolean - Whether we should animate the chart    
36     animation : true,
37     
38     //Number - Amount of animation steps
39     animationSteps : 100,
40     
41     //String - Animation easing effect
42     animationEasing : "easeOutBounce",
43     
44     //Boolean - Whether we animate the rotation of the Pie
45     animateRotate : true,
46 
47     //Boolean - Whether we animate scaling the Pie from the centre
48     animateScale : false,
49     
50     //Function - Will fire on animation completion.
51     onAnimationComplete : null
52 }
53             /// 创建对象,生成图表
54             new Chart(ctx).Pie(data,options);
55         </script>
56     </body>
57 </html>
58             

效果如下:

⑤,极坐标区域图(Polararea charts)

代码如下:

  1 <html>
  2     <head>
  3         <title>TestChart.js</title>
  4         <script src="Chart.js" ></script>
  5     </head>
  6     <body>
  7         <canvas id="myChart" width="400" height="400"></canvas>
  8         <script type="text/javascript">
  9             var ctx = document.getElementById("myChart").getContext("2d");
 10             var data = [
 11     {
 12         value : 30,
 13         color: "#D97041"
 14     },
 15     {
 16         value : 90,
 17         color: "#C7604C"
 18     },
 19     {
 20         value : 24,
 21         color: "#21323D"
 22     },
 23     {
 24         value : 58,
 25         color: "#9D9B7F"
 26     },
 27     {
 28         value : 82,
 29         color: "#7D4F6D"
 30     },
 31     {
 32         value : 8,
 33         color: "#584A5E"
 34     }
 35 ]
 36             /// 动画效果
 37             var options = {
 38                 
 39     //Boolean - Whether we show the scale above or below the chart segments
 40     scaleOverlay : true,
 41     
 42     //Boolean - If we want to override with a hard coded scale
 43     scaleOverride : false,
 44     
 45     //** Required if scaleOverride is true **
 46     //Number - The number of steps in a hard coded scale
 47     scaleSteps : null,
 48     //Number - The value jump in the hard coded scale
 49     scaleStepWidth : null,
 50     //Number - The centre starting value
 51     scaleStartValue : null,
 52     
 53     //Boolean - Show line for each value in the scale
 54     scaleShowLine : true,
 55     
 56     //String - The colour of the scale line
 57     scaleLineColor : "rgba(0,0,0,.1)",
 58     
 59     //Number - The width of the line - in pixels
 60     scaleLineWidth : 1,
 61     
 62     //Boolean - whether we should show text labels
 63     scaleShowLabels : true,
 64     
 65     //Interpolated JS string - can access value
 66     scaleLabel : "<%=value%>",
 67     
 68     //String - Scale label font declaration for the scale label
 69     scaleFontFamily : "'Arial'",
 70     
 71     //Number - Scale label font size in pixels    
 72     scaleFontSize : 12,
 73     
 74     //String - Scale label font weight style    
 75     scaleFontStyle : "normal",
 76     
 77     //String - Scale label font colour    
 78     scaleFontColor : "#666",
 79     
 80     //Boolean - Show a backdrop to the scale label
 81     scaleShowLabelBackdrop : true,
 82     
 83     //String - The colour of the label backdrop    
 84     scaleBackdropColor : "rgba(255,255,255,0.75)",
 85     
 86     //Number - The backdrop padding above & below the label in pixels
 87     scaleBackdropPaddingY : 2,
 88     
 89     //Number - The backdrop padding to the side of the label in pixels    
 90     scaleBackdropPaddingX : 2,
 91 
 92     //Boolean - Stroke a line around each segment in the chart
 93     segmentShowStroke : true,
 94     
 95     //String - The colour of the stroke on each segement.
 96     segmentStrokeColor : "#fff",
 97     
 98     //Number - The width of the stroke value in pixels    
 99     segmentStrokeWidth : 2,
100     
101     //Boolean - Whether to animate the chart or not
102     animation : true,
103     
104     //Number - Amount of animation steps
105     animationSteps : 100,
106     
107     //String - Animation easing effect.
108     animationEasing : "easeOutBounce",
109 
110     //Boolean - Whether to animate the rotation of the chart
111     animateRotate : true,
112     
113     //Boolean - Whether to animate scaling the chart from the centre
114     animateScale : false,
115 
116     //Function - This will fire when the animation of the chart is complete.
117     onAnimationComplete : null
118 }
119             /// 创建对象,生成图表
120             new Chart(ctx).PolarArea(data,options);
121         </script>
122     </body>
123 </html>
124             

效果如下:

⑥,圆环图(Doughnutcharts)

代码如下:

 1 <html>
 2     <head>
 3         <title>TestChart.js</title>
 4         <script src="Chart.js" ></script>
 5     </head>
 6     <body>
 7         <canvas id="myChart" width="400" height="400"></canvas>
 8         <script type="text/javascript">
 9             var ctx = document.getElementById("myChart").getContext("2d");
10             var data = [
11     {
12         value: 30,
13         color:"#F7464A"
14     },
15     {
16         value : 50,
17         color : "#E2EAE9"
18     },
19     {
20         value : 100,
21         color : "#D4CCC5"
22     },
23     {
24         value : 40,
25         color : "#949FB1"
26     },
27     {
28         value : 120,
29         color : "#4D5360"
30     }
31 
32 ]
33             /// 动画效果
34             var options = {
35     //Boolean - Whether we should show a stroke on each segment
36     segmentShowStroke : true,
37     
38     //String - The colour of each segment stroke
39     segmentStrokeColor : "#fff",
40     
41     //Number - The width of each segment stroke
42     segmentStrokeWidth : 2,
43     
44     //The percentage of the chart that we cut out of the middle.
45     percentageInnerCutout : 50,
46     
47     //Boolean - Whether we should animate the chart    
48     animation : true,
49     
50     //Number - Amount of animation steps
51     animationSteps : 100,
52     
53     //String - Animation easing effect
54     animationEasing : "easeOutBounce",
55     
56     //Boolean - Whether we animate the rotation of the Doughnut
57     animateRotate : true,
58 
59     //Boolean - Whether we animate scaling the Doughnut from the centre
60     animateScale : false,
61     
62     //Function - Will fire on animation completion.
63     onAnimationComplete : null
64 }
65             /// 创建对象,生成图表
66             new Chart(ctx).Doughnut(data,options);
67         </script>
68     </body>
69 </html>
70             

效果如下:

 

 

 

 

转载于:https://www.cnblogs.com/huashui/p/3413349.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/575691.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php将图片导入,php中图片文件的导入,上传与下载

---------------------------------------------图片的导入-------------------------------------------------------------------图片的上传与下载上传图片:序号图片添加时间操作//打开目录$diropendir("./images");//遍历目录$i;while($freaddir($dir)){if($f!&qu…

用parsetInt解析数字,并求和

实现代码&#xff1a; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns"http://www.w3.org/1999/xhtml" xml:lang"en"> <h…

oracle arp绑定mac地址,使用ARP命令来绑定IP和MAC地址

使用ARP命令来绑定IP和MAC地址前言&#xff1a;我本来没有想过写关于ARP绑定的文章&#xff0c;坦白的说一句&#xff0c;在你理解ARP工作的原理时&#xff0c;这其实比较简单。只是看到最近论坛很多人在问关于绑定IP和MAC地址的问题&#xff0c;所以才决定写这个文章&#xff…

阿里巴巴2013年实习生笔试题A

一、单项选择题 1.下列说法不正确的是&#xff1a;&#xff08;B&#xff09; A.SATA硬盘的速度速度大约为500Mbps/s B.读取18XDVD光盘数据的速度为1Gbps C.前兆以太网的数据读取速度为1Gpbs D.读取DDR3内存数据的速度为100Gbps 解析&#xff1a;有说B的&#xff0c;有说D的&am…

linux之间安全传输文件,使用SCP安全地传输文件[Linux] | MOS86

终端访问远程Linux机器的最常见方法是使用安全Shell(SSH)。要工作&#xff0c;Linux服务器需要运行SSH服务器(OpenSSH)&#xff0c;另一端需要一个SSH客户端&#xff0c;像Windows中的PuTTy&#xff0c;或者Linux上的ssh命令行工具&#xff0c;或者其他类似Unix的操作系统&…

putty远程登录linux有啥用,putty 自动远程登录linux

在实际的开发和学习中我们会频繁的使用某些远程登录工具&#xff0c;通过网络登录到linux系统中进行程序编写和调试。Putty是比较流行的工具&#xff0c;但是在putty下每次链接到远端linux都要重新输入用户名和密码&#xff0c;就显得有些麻烦了。那么&#xff0c;有没有什么方…

eclipse中对单独JS文件取消报错的处理

eclipse中对单独JS文件取消报错的处理 eclipse中js文件报错的情况&#xff0c;或许大家早已习以为常了&#xff0c;那么有什么好的方法可以将其忽略掉呢&#xff1f;如果你也在寻找此问题&#xff0c;那么本文或许可以帮助到你 - 忽略某个js文件报错的方法&#xff1a; Project…

c语言方向变量,C语言,变量与内存

一、数在计算机中的二进制表示符号位&#xff1a;最高位为符号位&#xff0c;正数该位为0&#xff0c;负数该位为1&#xff1b;原码&#xff1a;原码就是符号位加上真值的绝对值, 即用第一位表示符号, 其余位表示值反码&#xff1a;正数的反码是其本身&#xff1b;负数的反码是…

新距离

1、这是个现实的社会&#xff0c;感情不能当饭吃&#xff0c;贫穷夫妻百事哀。不要相信电影里的故事情节&#xff0c;那只是个供许多陌生人喧嚣情感的场所。只有不理智和不现实的人才相信。  2、给自己定目标&#xff0c;一年&#xff0c;两年&#xff0c;五年&#xff0c;也…

android开发 文件分享到应用,Android开发之——7.0适配之应用之间共享文件(FileProvider)...

前言Android 7.0强制启用了被称作StrictMode的策略&#xff0c;带来的影响就是你的App对外无法暴露file://类型的URI了。如果你使用Intent携带这样的URI去打开外部App(比如&#xff1a;打开系统相机拍照)&#xff0c;那么会抛出FileUriException异常。官方给出解决这个问题的方…

android涂鸦板保存功能,android实现涂鸦,保存涂鸦后的图片,清屏

自定义view的类&#xff0c;代码如下&#xff1a;[html]package com.xy.tuya;import android.annotation.SuppressLint;import android.content.Context;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.graphics.Canvas;import android…

浏览器与服务器响应流程-----(转)

一. 解析域名地址为IP地址 浏览器DNS缓存&#xff1a;以Chrome为例&#xff0c;在浏览器窗口中输入chrome://net-internals/#dns&#xff0c;就可以查看当前浏览器DNS缓存记录&#xff0c;chrome的DNS缓存过期时间还是比较短的&#xff0c;大约为1分钟。 本机DNS缓存&#xff1…

Pc-98 android,PC安卓多功能搞机助手3.98

V3.98版本更新日志&#xff1a;1.全新多设备检测机制&#xff0c;底层代码重写&#xff1b;2.新增支持检测安卓用户是否允许当前电脑调试设备&#xff1b;3.软件冻结#卸载中新增清除指定应用数据&#xff1b;4.小米线刷检测功能优化&#xff0c;修复之前版本不能正确识别设备是…

拼接路径的两种方式

//本文永久链接,转载请注明出处:http://www.cnblogs.com/ChenYilong/p/3490669.html https://www.evernote.com/shard/s227/sh/1401e497-899e-4b04-9ff6-e1d9638e9f25/f6b722ed5cb2c5f603a9b242ee7fe230转载于:https://www.cnblogs.com/ChenYilong/p/3490669.html

android像素鸟,像素鸟Flappy Bird

Flappy Bird是最近非常热门的一款像素游戏&#xff0c;Flappy Bird 的游戏规则异常简单&#xff1a;和Frogmind Games的成名作品BADLAND类似&#xff0c;玩家只需要点击屏幕就可以操作游戏&#xff0c;控制角色通过各种障碍。看似简单的规则下是让人抓狂的游戏难度。首先&#…

Android是什么 之三手机之硬件形态

手机硬件形态  本节可能与Android无关&#xff0c;但是Android系统现在这个阶段更多的是移动终端形态的开发平台&#xff0c;本节给出了Android背后的工作-Android管理的硬件是什么&#xff0c;Android的本质就是要管理好这些硬件部分&#xff0c;为用户提供一个体验更好&…

品味性能之道十一:JAVA中switch和if性能比较

通常而言大家普遍的认知里switch case的效率高于if else。根据我的理解而言switch的查找类似于二叉树&#xff0c;if则是线性查找。按照此逻辑推理对于对比条件数目大于3时switch更优&#xff0c;并且对比条件数目越多时switch的优势越为明显。一、测试目的最近与开发同学对于前…

miniblink载入html,winform使用miniblink展示html(全屏)

【实例简介】使用miniblink 展示html的例子&#xff0c;miniblink基于chromium的浏览器控件【实例截图】点击下图中的百度&#xff0c;即可 实现全屏访问 百度网页 &#xff0c;如下图&#xff1a;其实是winform嵌入的这个网页&#xff0c;打开即是 全屏效果【核心代码】using …

html设置照片模糊效果,CSS如何实现照片模糊?

在开发网页时&#xff0c;照片模糊处理会经常被使用&#xff0c;比如当我们背景图的模糊&#xff0c;当我们不想背景图片过于突出影响美观时&#xff0c;就可以设置将照片模糊处理&#xff0c;突出文字部分。那么 CSS 如何实现照片模糊呢&#xff1f;这篇文章 w3cschool 小编告…

女生学计算机未来出路,计算机真的已经烂大街了吗,女生学计算机没出路吗?...

假的。先说第一个问题&#xff1a;情况是&#xff0c;现在程序员是很多&#xff0c;但多半是中低端程序员&#xff0c;高端程序员供不应求&#xff0c;薪资一涨再涨。现在的程序员门槛一高再高&#xff0c;就是为了淘汰掉那些半吊子的程序员。如果你是靠从网上复制粘贴代码的“…