
js
Claroja
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
promise async await
1.当异步函数嵌套到别的函数内后,需要循环使用async和await否则就会变成异步async getEventList () { const { data: res } = await this.$http.get('/events') this.eventList = res},async updateEvent () { await this.$http.post('/events/update', this.currentEvent)},async finish () {原创 2021-02-17 18:23:37 · 160 阅读 · 0 评论 -
js <->java 时区处理
UTCUTC(Coordinated Universal Time)GMT依赖于地球自转,而地球自转不规则,所以使用原子时钟报时的UTC替代.javascriptnew Date().toISOString() //UTC zero 时间"2021-02-08T14:50:24.541Z"javaSystem.out.println(ZonedDateTime.now(ZoneId.of("UTC")));2021-02-08T14:54:16.024Z[UTC]System.out.pr原创 2021-02-09 00:00:27 · 236 阅读 · 1 评论 -
js 高级 call()
call()可以调用函数call()可以修改this的指向,使用call()的时候 参数一是修改后的this指向,参数2,参数3…使用逗号隔开连接 function fn(x, y) { console.log(this); console.log(x + y);} var o = { name: 'andy' }; fn.call(o, 1, 2);//调用了函数此时的this指向了对象o,输出:{name: "andy"}3...原创 2021-01-23 14:44:04 · 175 阅读 · 0 评论 -
js 高级 原型对象
原型链任何对象都有原型对象,也就是prototype属性,任何原型对象也是一个对象,该对象就有__proto__属性,这样一层一层往上找,就形成了一条链,我们称此为原型链;函数类,实例和原型对象三角关系1.构造函数的prototype属性指向了构造函数原型对象2.实例对象是由构造函数创建的,实例对象的__proto__属性指向了构造函数的原型对象3.构造函数的原型对象的constructor属性指向了构造函数,实例对象的原型的constructor属性也指向了构造函数原型链和成员的查找机制当访原创 2021-01-23 14:43:43 · 152 阅读 · 0 评论 -
js 高级 prototype
function Person(uname, age) { this.uname = uname; this.sing = function() { console.log('我会唱歌'); }}var person1 = new Person('wang', 18);var person2 = new Person('wei', 18);person1.sing();//我会唱歌person2.sing();//我会唱歌这里person1和person.原创 2021-01-23 14:43:01 · 142 阅读 · 0 评论 -
js 高级 constructor构造函数
对象原型(__proto__)和构造函数(prototype)原型对象里面都有一个属性 constructor 属性,它指回构造l类本身. function Person(uname, age) { this.uname = uname; this.sing = function() { console.log('我会唱歌'); }}var person1 = new Person('wang', 18);var person2 = new Person('we原创 2021-01-23 14:42:33 · 1007 阅读 · 0 评论 -
js 高级-创建对象
1.字面量创建var obj = {};2.函数形式function Person(name,age){ this.name = name; this.age = age;}var obj = new Person('zs',12);原创 2021-01-23 14:42:06 · 117 阅读 · 0 评论 -
OGR
from osgeo import ogrimport sysfrom osgeo import ogrdriver = ogr.GetDriverByName('ESRI Shapefile')dataSource = driver.Open(inshp,0)Layer(图层)由同种要素(Feature)(如点、线、多边形等)组在一起的“层”GetLayer的参数是从0开始的。对于Shapefile而言,它只有一个图层,一般情况下这个参数都是0,如果空着,缺省情况下也是0。from os原创 2020-06-22 22:08:20 · 275 阅读 · 2 评论 -
javascript async await
参考:https://segmentfault.com/a/1190000007535316原创 2020-06-22 22:08:09 · 141 阅读 · 0 评论 -
javascript promise
参考:https://blog.youkuaiyun.com/qq_34645412/article/details/81170576https://blog.youkuaiyun.com/weixin_33704234/article/details/91381041原创 2020-06-22 22:08:02 · 158 阅读 · 0 评论 -
D3 Nests
Nestshttps://github.com/d3/d3/blob/master/API.md#nestsd3.nest - create a new nest generator.nest.key - add a level to the nest hierarchy.nest.sortKeys - sort the current nest level by key.nest.sortValues - sort the leaf nest level by value.nest.rollu原创 2020-06-22 22:07:55 · 272 阅读 · 0 评论 -
地图数据
shp 文件格式geojson 文件格式 https://github.com/tmcw/awesome-geojsontopo 文件格式ogr2ogr 使用 FWTools247.exe ogr2ogr.exe./ogr2ogr -f "geojson" ./test.json D:/code/d3/ne_10m_admin_1_states_provinces/ne_10m_admin_1_states_provinces.shp -where "ADM0_A3 IN('CHN')"http原创 2020-06-22 22:07:48 · 367 阅读 · 0 评论 -
GDAL
GDAL 是 Geospatial Data Abstraction Library 的缩写, 最开始的时候是一个用来处理栅格空间数据的类库,OGR 则是则是来处 理矢量数据的。参考:https://www.osgeo.cn/pygis/gdal-gdalintro.html#原创 2020-06-22 22:07:36 · 170 阅读 · 0 评论 -
Geojson
GeoJSON是JS定义的地理空间信息数据格式.在IETF RFC 4627中有具体定义.GeoJSON对象必须是名为“type”的成员。type成员的值必须是下面之一: Point , MultiPoint , LineString , MultiLineString , Polygon , MultiPolygon , GeometryCollection , Feature 或 FeatureCollection 。FeatureCollectiontype为FeatureCollection原创 2020-06-22 22:07:28 · 382 阅读 · 1 评论 -
D3 Handling Events
this代表的就是当前元素 <p id = "test">click</p> <script> // var para = document.getElementById("test") // para.onclick = function(){this.innerHTML = "Done"} d3.select("#test") .on("click",function(){d3.原创 2020-06-22 22:07:15 · 182 阅读 · 0 评论 -
D3 tree&cluster
<script> var svg = d3.select('body') .append('svg') .attr("width",300) .attr('height',300) var data = { "name":"中国", "children":[ {"name":"河南","children":[{"name":"...原创 2020-06-22 22:07:03 · 390 阅读 · 0 评论 -
D3 chord
https://github.com/d3/d3/blob/master/API.md#chords-d3-chordd3.chord - create a new chord layout.chord - compute the layout for the given matrix.chord.padAngle - set the padding between adjacent groups.chord.sortGroups - define the group order.chord.so原创 2020-06-22 22:06:57 · 160 阅读 · 0 评论 -
D3 force
https://github.com/d3/d3/blob/master/API.md#forces-d3-force var svg = d3.select('body') .append('svg') .attr("width",300) .attr('height',300) var nodes = [{name:"0"},{name:"1"}] var edges = [{sour原创 2020-06-22 22:06:50 · 248 阅读 · 0 评论 -
D3 pie
https://github.com/d3/d3/blob/master/API.md#pies <script> svg = d3.select('body') .append('svg') .attr("width",300) .attr('height',300) data=[["女生",43],["男生",57]] //设置pie布局转换器 v原创 2020-06-22 22:06:43 · 405 阅读 · 0 评论 -
D3 淡入效果
<script> svg = d3.select('body') .append('svg') .attr("width",300) .attr('height',300) data=[[100,100]] var update = svg.selectAll('circle') .data(data) var enter = u...原创 2020-06-22 22:06:32 · 261 阅读 · 0 评论 -
D3 chord
https://github.com/d3/d3/blob/master/API.md#chords-d3-chordd3.chord - create a new chord layout.chord - compute the layout for the given matrix.chord.padAngle - set the padding between adjacent groups.chord.sortGroups - define the group order.chord.s原创 2020-06-22 22:06:27 · 426 阅读 · 0 评论 -
D3 Symbols
https://github.com/d3/d3/blob/master/API.md#symbolsd3.symbol - create a new symbol generator.symbol - generate a symbol for the given datum.symbol.type - set the symbol type.symbol.size - set the size of the symbol in square pixels.symbol.context - se原创 2020-06-22 22:06:19 · 269 阅读 · 0 评论 -
D3 arc
https://github.com/d3/d3/blob/master/API.md#arcsinnerRadius() 内半径outerRadius() 外半径startAngle()起始角度endAngle()终止角度 <script> svg = d3.select('body') .append('svg') .attr("width",300) .attr('height',30原创 2020-06-22 22:06:13 · 718 阅读 · 0 评论 -
D3 area
https://github.com/d3/d3/blob/master/API.md#areas区域生成器svg = d3.select('body') .append('svg') .attr("width",300) .attr('height',300)var lines = [100,150,80,200]var areaPath = d3.svg.area() .x((d,i)=>50+i*50) //原创 2020-06-22 22:06:05 · 577 阅读 · 0 评论 -
D3 line
绘制线段1.最原始的做法<line x1="10",y1="10",x2="20",y2="20">svg.append('line') .attr('x1',10) .attr('y1',10) .attr('x2',20) .attr('y2',20)2.使用path<path d="M20,20L300,100">svg.append('path') .attr('d',"M20,20L300,100")3.使用d3的线段生成器原创 2020-06-22 22:05:58 · 1457 阅读 · 0 评论 -
D3 BarChart
基本绘制柱形图基本绘制方法,注意enter的使用,免去了事先写好rect元素的麻烦//设置画布var width = 400var height = 400var svg = d3.select('body') .append('svg') .attr('width',width) .attr('height',height)//设置柱形图数据集var dataset = [50,43,120,87,99,167,142]原创 2020-06-22 22:05:51 · 466 阅读 · 0 评论 -
D3 RGB&HSL
RGB(Red,Green,Blue),三个通道范围都是0~255,所以可以表示255255255=16777216种颜色https://github.com/d3/d3/blob/master/API.md#colors-d3-colord3.rgb(r, g, b[, opacity]) //使用三个通道的数值来创建,每个通道的范围是0~255d3.rgb(specifier)d3.rgb(color) 使用字符串来创建HSL(Hue,Saturation,Lightness),色相,饱和原创 2020-06-22 22:05:45 · 738 阅读 · 0 评论 -
D3 scaleOrdinal
Ordinal Scale(序数比例尺)的定义域和值域都是离散的.var ordinal = d3.scaleOrdinal() .domain([1,2,3]) .range([10,20,30])console.log(ordinal(1))//10d3.scaleOrdinal - create an ordinal scale.ordinal - compute the range value corresponding to a given domain value.原创 2020-06-22 22:05:14 · 1709 阅读 · 0 评论 -
D3 scaleThreshold
Threshold(阈值)比例尺domain的值将空间分割,来对应rangehttps://github.com/d3/d3/blob/master/API.md#quantize-scalesvar threshold = d3.scaleThreshold() .domain([10,20]) .range(["red","blue","black"])console.log(threshold(5))//redconsole.log(threshold(15))//blue原创 2020-06-22 22:05:08 · 529 阅读 · 0 评论 -
D3 scaleQuantize
(Quantize Scale)定义域是连续的,值域是离散的经常用于值对应颜色https://github.com/d3/d3/blob/master/API.md#quantize-scalesvar quan = d3.scaleQuantize() .domain([0,10]) .range(["red","blue","green","yellow"])console.log(quan(1))//redd3.scaleQuantize - create a uniform原创 2020-06-22 22:05:01 · 515 阅读 · 0 评论 -
D3 scalePow
var pow = d3.scalePow().exponent(3)console.log(pow(2))//输出为8pow - compute the range value corresponding to a given domain value.pow.invert - compute the domain value corresponding to a given range value.pow.exponent - set the power exponent.pow.domai原创 2020-06-22 22:04:51 · 309 阅读 · 0 评论 -
D3 scaleLinear
var linear = d3.scaleLinear() .domain([0,1]) .range([0,100])console.log(linear(0.5))//50d3.scaleLinear - create a quantitative linear scale.continuous - compute the range value corresponding to a given domain value.continuous.invert - compute原创 2020-06-22 22:04:44 · 2284 阅读 · 0 评论 -
D3 Sets
Setshttps://github.com/d3/d3/blob/master/API.md#setsd3.set - create a new, empty set.set.has - returns true if the set contains the given value.set.add - add the given value.set.remove - remove the given value.set.clear - remove all values.set.value原创 2020-06-22 22:04:35 · 154 阅读 · 0 评论 -
D3 Map
Mapshttps://github.com/d3/d3/blob/master/API.md#mapsd3.map - create a new, empty map.map.has - returns true if the map contains the given key.map.get - get the value for the given key.map.set - set the value for the given key.map.remove - remove the原创 2020-06-22 22:04:25 · 585 阅读 · 0 评论 -
javascript 控制语句
分支语句ififif(条件){ 语句;}if-elseif(条件){ 语句;}else{ 语句; }else ifif(条件1){ 语句;}else if(条件2){ 语句;}else{ 语句;}switch-caseswitch(表达式){ case 整型常量1: 语句; break; /* 可选的 */ case 整型常量2: 语句; break; /* 可选的 */原创 2020-06-22 22:04:04 · 151 阅读 · 0 评论 -
D3 Array
统计函数https://github.com/d3/d3/blob/master/API.md#statisticsd3.min - compute the minimum value in an array.d3.max - compute the maximum value in an array.d3.extent - compute the minimum and maximum value in an array.d3.sum - compute the sum of an array原创 2020-06-22 21:44:53 · 299 阅读 · 0 评论 -
D3 transtion
https://github.com/d3/d3/blob/master/API.md#transitions-d3-transition没有调用transition(),append()返回的是选择集对象selection调用transition()后,返回的是一个过度对象transition,没有data()``dataum()方法,是不可以绑定数据的使用delay``duration``ease来设置延迟,过渡时间,过渡样式 <script> svg = d3原创 2020-06-22 21:41:44 · 396 阅读 · 0 评论 -
D3 Collection
1.对象(Object)方法描述d3.keys(object)获得对象的keyd3.values(object)获得对象的valued3.entries(object)获得对象的key和value2.Map方法描述d3.map([object[, key]])创建map,可以将数组传入,然后根据key参数方法指定keymap.has(key)returns true if the map contains the given ke原创 2020-06-22 21:39:12 · 353 阅读 · 0 评论 -
D3 Geographies
地理路径生成器var projection = d3.geo.mercator() .center([0,0]) .scale(100) .translate([width/2,height/2]) .rotate()var path = d3.geo.path() .projection(projection);原创 2020-06-22 21:38:43 · 757 阅读 · 0 评论 -
D3 interpolate
https://github.com/d3/d3/blob/master/API.md#interpolators-d3-interpolate将颜色范围均分var a = d3.rgb(255,0,0)var b = d3.rgb(0,255,0)var compute = d3.interpolate(a,b)console.log(compute(0.2))d3.interpolate - interpolate arbitrary values.d3.interpolateArra原创 2020-06-22 21:38:18 · 1343 阅读 · 0 评论