我的4G一打王者荣耀怎么退出师门他就退出

echarts散点图使用 - 前端开发 - IT工作生活这点事
现在位置 /
给您更多信息和帮助
在这里您可以找到更多: 技术交流群:
投稿:承接:企业网站门户/微网站/微商城/CMS系统/微信公众号运营/业务咨询
echarts教程系列
[] [] [] [] [] [] [] [] []
本月最热文章
微信扫一扫,徜徉悠嘻网,您的休闲乐园
技术交流群:
专业专注:企业网站门户/微网站/微商城/CMS系统/微信公众号运营/付费问题咨询关键字:    
当前位置: >
ECharts v3.5.4
详细介绍 - [ ECharts v3.5.4 ]
ECharts v3.5.4 &更新日志
修复了对 水球图 clipPath 的支持问题。
修复了 label 设置为 insideTop 时的位置。
修复了 SVG PathData transform 时的问题。
ECharts简介
ECharts(EnterpriseCharts商业产品图表库)提供商业产品常用图表,底层基于ZRender(一个全新的轻量级canvas类库),创建了坐标系,图例,提示,工具箱等基础组件,并在此上构建出折线图、柱状图、散点图、K线图、饼图、雷达图、地图、和弦图、力导向布局图、仪表盘以及漏斗图,同时支持任意维度的堆积和多图表混合展现。
Echartsdevice
Echartsexplorer
支持IE6/7/8/9+,chrome、firefox、safari、opera
(IE8-powerbyexcanvas)
ECharts功能特色
我们诚挚邀请你翻阅这份在线文档《WhyECharts?》你可以从中更直观的体验到ECharts的特性以及快速浏览到所有图表类型。
*文档中展现的个别特性在IE8-中并没有得到支持,所以建议使用IE9+、chrome、safari、firefox或opera等现代浏览器阅读这份文档。
Echartsmix
混搭的图表会更具表现力也更有有趣味,ECharts提供的图表(共11类17种)支持任意混搭:
折线图(面积图)、柱状图(条形图)、散点图(气泡图)、K线图、
饼图(环形图)、雷达图、地图、和弦图、力导布局图、仪表盘、漏斗图。
混搭情况下一个标准图表:包含唯一图例、工具箱、数据区域缩放、值域漫游模块,一个直角坐标系(可包含一条或多条类目轴线,一条或多条值轴线,最多上下左右四条)
拖拽重计算
拖拽重计算特性(专利)带来了数据统计图表从未有过的用户体验,允许用户对统计数据进行有效的提取、整合,甚至在多个图表间交换数据,赋予了用户对数据进行挖掘、整合的能力。
Echarts拖拽重计算
Echarts数据视图
如果你所呈现的数据足够让用户所关心,那么他们将不满足于查看可视化的图表,要去逐一迎合他们下载保存,数据分享,加工整合已有数据等等需求?
或许你只要给予一个&,&分隔的数据文本他们就懂了,这就是ECharts的数据视图!当然,你可以重载数据视图的输出方法,用你独特的方式去呈现数据。
如果你的用户足够的高端,你甚至可以打开数据视图的编辑功能,跟拖拽重计算相比,这可是批量的数据修改!
动态类型切换
很多图表类型本身所表现的能力是相似的,但由于数据差异、表现需求和个人喜好的不同导致最终图表所呈现的张力又大不一样,比如折线图和柱状图的选择,系列数据是堆叠还是平铺总是让人头疼。
ECharts提供了动态类型切换,让用户随心所欲的切换到他所需要的图表类型和堆叠状态。
Echarts动态类型切换
Echarts图例开关
多系列数据的同时展现呈现出丰富内容,但如何让用户切换到他所关心的个别系列上?
ECharts提供了方便快捷的多维度图例开关,可以随时切换到你所关心的数据系列。
数据区域选择
数据可以是无限的,但显示空间总是有限的,数据区域选择组件提供了大数据量中漫游的能力,让用户选择并呈现他所关心的数据区域。
配合随动的均值(极值)标线,标注展现强大的数据剖析能力。trythis》
Echarts数据区域缩放
Echarts多图联动
多系列数据在同一个直角系内同时展现有时候会产生混乱,但他们又存在极强的关联意义不可分离?
ECharts提供了多图联动的能力(connect),能做的可不仅仅是鼠标划过的详情显示,连接的多个图表会共享组件事件并且实现了保存图片时的自动拼接。trythis》
基于坐标的图表(如地图、散点图)通过色彩变化表现数值的大小能直观形象的展示数据分布。
但如何聚焦到我所关心的数值上?我们创造了称为值域漫游的功能,让你可以轻松进行数值筛选。
Echarts值域漫游
Echarts炫光特效
我们知道,很多时候我们需要一些吸引眼球的能力。
ECharts支持标注标线的炫光特效,特别用在地图上轻松实现百度迁徙数据可视化特效
大规模数据模式
如何展现成千上百万的数据?貌似除了用专业的统计工具(如MATLAB)外别无选择?
不,在拥有如此多交互特性下ECharts依然可以做到直角系图表(折、柱、散点、K线)20万数据秒级内渲染完成,这对于常规的应用,用现代浏览器就足以轻松展现百万规模的数据!
Echarts大规模散点图
Echarts动态数据添加Echarts动态数据添加
动态数据添加
如果你需要展示有实时变化的数据,相信这个动态接口会对你很有帮助。
趋势线?平均线?上升通道?支持位?专业的你自然知道该怎么用
提供标线辅助在K线图中可是必要的功能!当然,ECharts中的任何图表都可以使用。
Echarts标线辅助
Echarts多维度堆积
多维度堆积
支持多系列,多维度的数据堆积,配合自动伸缩的图形实体和直角坐标系,能呈现出更有内涵的统计图表~
子区域地图模式
地图类型支持world,china及全国34个省市自治区。同时支持子区域模式,通过主地图类型扩展出所包含的子区域地图,轻易输出全球176个国家地区和全国600多个省市区域简图,trythis》
Echarts子区域地图
Echarts标准GeoJson扩展
GeoJson地图扩展
内置地图由标准GeoJson地理数据并经过高效的压缩算法压缩生成的地图数据(大小仅为标准geoJson的30%左右)驱动而来。如果内置地图类型或数据如果并未满足你的项目需要,可通过简单动态注册产生你所需要的新类型,trythis》
添加额外的标注内容是常用的功能,如地图上标注某些特定位置,折线图上标注极值点或者柱形图里标线出变化趋势,ECharts全系列图表支持标注标线功能,并且与生俱来的可以响应图例开关、值域漫游等组件的交互功能。
Echarts全系列图表支持标注、标线Echarts全系列图表支持标注、标线
Echarts多级控制Echarts高度个性化
个性化定制
超过600个可配置选项结合多级控制设计满足高度定制的个性化需求。
可以捕获的用户交互和数据变化事件实现图表间或者与外界的联动。trythis&
事件调试trythis&
Echarts事件交互
Echarts百搭时间轴
百搭时间轴
时空数据分析是信息可视化里一个相当重要的方向!ECharts提供可与任意图表搭配使用的时间轴控件以展现时空数据变化。
ECharts页面截图展示&
&同类推荐:
下载地址 - [ ECharts v3.5.4 ]
推荐使用、下载,请使用解压文件;
下载本站资源,如服务器暂不能下载请过一段时间再试;
本站资源通过 、 等软件检测;
本站部分资源供学习交流使用,如商业用途,请购正版。
网友对“ECharts v3.5.4”的评论
评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
& 下一篇:
您喜欢这个源码么?
本类热门源码
增值电信业务经营许可证:苏B2-CopyRight ©
All Rights reserved.[转载]用R制作百度Echarts交互图文档(1)
经反复确认,“非法字符”位于Grammar的palette用法一节。我实在看不出哪里有非法字符。渣浪你敢不敢敞亮点直接说出来?
Intro 前言
本工具来源于百度开发的国内顶尖水平的开源d3-js可视项目()。Yang Zhou和Taiyun Wei基于该工具开发了包,经Yihui
Xie后,可通过htmlwidgets传递js参数,大大简化了开发难度。但此包开发仍未完成。为了赶紧上手用,基于该包做了一个函数echartR,用于制作。需要R版本&=3.2.0.
This tool originates from
a top-tier&d3-js
visualization project of China: (). Yang Zhou and
Taiyun Wei developed an experimental R package
based on it,
which then evoluted into
by Yihui Xie
to pass js parameters through &htmlwidgets.
The package is sill uder development. I developed a function
based on this package to make . This function
requires R&=3.2.0.
echartR的主要工作是将Echarts参数封装成list,Yihui Xie的原型函数echart被用来处理这个list。echart函数的如下,除了数据本身,并没有提供其他参数的位置。
echartR majorly packs Echarts parameters into a list while
the prototype function developed by Yihui Xie, is used to parse the
of &echart
is as follows, which does not provide parameters entry other than
dataset itself.
if (! 'recharts' %in% installed.packages()[,1]){
install.packages('recharts',
repos = c('http://yihui.name/xran', '')
library(recharts)
echart(iris, ~Sepal.Length, ~Sepal.Width)
echart(iris, ~Sepal.Length, ~Sepal.Width, series = ~Species)
Usage 用法
首先,安装好最新版的和
了解最基本的R语言技巧,能够用R整理、读写数据集
最好会用knitr,会写
Installation 安装
安装 Install
(install.packages('devtools'))
安装 Insall recharts (install_github('yihui/recharts'))
下载 Download
&echartR.R脚本文件到本地位置
script file to local disk: )
调用 Source
脚本 script (假设我将脚本放在本地 suppose I stored the script to local GitHub
Repo: &source("~/Github/recharts/R/echartR.R"))
Grammar 语法
echartR(data, x=NULL, y, z=NULL, series=NULL, weight=NULL,
xcoord=NULL, ycoord=NULL, x1=NULL, xcoord1=NULL, ycoord1=NULL,
type="scatter", stack=FALSE,
title=NULL, subtitle=NULL, title_url=NULL, subtitle_url=NULL,
symbolList=NULL, dataZoom=NULL,
dataRange=NULL, splitNumber=NULL, dataRangePalette=NULL,
xAxis=list(lab=NULL,color=NULL,splitLine=T,banded=F,rotate=0), xlab=NULL,
yAxis=list(lab=NULL,color=NULL,splitLine=T,banded=F,rotate=0), ylab=NULL,
xAxis1=list(lab=NULL,series=NULL,reverse=F,color=NULL,splitLine=T,
banded=F,rotate=0), xlab1=NULL,
yAxis1=list(lab=NULL,series=NULL,reverse=F,color=NULL,splitLine=T,
banded=F,rotate=0), ylab1=NULL,
xyflip=FALSE, AxisAtZero=TRUE, scale=TRUE,
palette='aetnagreen', tooltip=TRUE, legend=TRUE, toolbox=TRUE,
pos=list(title=6, legend=11, toolbox=1, dataZoom=6, dataRange=8, roam=2),
calculable=TRUE, asImage=FALSE,
markLine=NULL, markLinesmooth=NULL, markPoint=NULL,
theme=list(backgroundColor=NULL, borderColor=NULL, borderWidth=1),
data: 数据集 dataset
x: x变量,直方图、饼图、环形图、玫瑰图可省略。x variable, only
omitable for histograms, pie, ring and rose charts。
y: y变量 y variable
z: z变量,只接受时间/日期变量,并打开时间轴。z variable, only accept
data/time variable to open time axis
series: Series(系列)变量 series variable
weight: 权重变量,可用于直方图、气泡图等 weight variable, used
in histogram, bubble, etc
xcoord: 纬度坐标变量,仅用于点/线标注的map。Latitude variable,
only for point/line-marking map.
ycoord: 经度坐标变量,仅用于点/线标注的map。Longitude variable,
only for point/line-marking map.
x1: 备用自变量,仅用于线标注的地图、力导向图和和弦图。Backup x variable,
only for line-marking map, force and chord chart.
xcoord1: 备用纬度坐标变量,仅用于线标注的map。Backup latitude
variable, only for line-marking map.
ycoord1: 备用经度坐标变量,仅用于线标注的map。Backup Longitude
variable, only for line-marking map.
type: 默认
default&scatter,可选
options "scatter", "bubble", "bar", "line", "linesmooth", "map",
"k", "pie", "ring", "rose","area", "areasmooth", "chordribbon",
"chord", "force", "tree", "treemap", "wordcloud", "heatmap",
"histogram", "funnel", "pyramid", "radar", "radarfill"
如选择map,则控制项必须写作一个长度为3的向量:c(“map”,mapType,markType)。mapType可选“world”、“china”,或简体中文表示的具体中国地名。markType为area时,用区块颜色表示效应大小;为point时,用点在地图上做标注;为line时,用线条在地图上做标注。默认为c("map","china","area")。If&map&was
chosen, the control option should be a vector of length 3:
c("map",mapType,markType).&mapType&could
be either "world" or “china”, of which simplified Chinese names are
required for 'china'. When&markType&equals
to “area”, the function colors polygons while
equals to “point”, it t while equals to
“line”, it ticks lines on the map.
默认FALSE,是否堆积。用于制作堆积条图、柱图、线图和面积图等直角坐标系图形。Default to FALSE (do not
stack). Used in stacked column, bar, line and area chart,
title: 标题 title of the figure
subtitle: 副标题 subtitle of the figure
图形要素的位置,写作一个列表,用1-12点钟方向指示。标题默认6点位,即底部居中位置。图例、工具箱、值域漫游轴、数据缩放轴、地图漫游控件默认位置分别是11、1、6、8、2点钟位。Position
of image elements which are integers 1-12. Title position default
to 6 (o'clock), which means bottom middle. Defaults to legend,
toolbox, dataRange, dataZoom, roamController are 11, 1, 6, 8, 2,
respectively.
title_url: 标题链接,url of the title
subtitle_url: 副标题链接, url of the
symbolList:
图形标志。可使用数组循环使用,如数组长度小于series水平数,则以最后一个标志填充。如设置为NULL或不设置,则循环显示Echarts默认的标志图形列表:c("circle","rectangle","triangle","diamond","emptyCircle","emptyRectangle","emptyTriangle","emptyDiamond")。也可任意指定"heart","droplet","pin","arrow","star5","star6"等非标图形。设为'none'则不显示。A
vector assigning symbols. You can use an array of symbols. If the
length of the symbols array is smaller than number of levels of the
series, the last symbol will be used to extend the array. If you
set symbolList NULL or leave it unset, the function circulates the
default symbol list of Echarts:
c("circle","rectangle","triangle","diamond","emptyCircle","emptyRectangle","emptyTriangle","emptyDiamond").
You can also assign non-standard symbols, such as
"heart","droplet","pin","arrow","star5","star6", "star7",
etc.& When assigned to 'none', no symbols are
dataZoom: 数据缩放轴,默认FALSE. The axis to zoom data.
Default to FALSE. 如dataZoom=TRUE,默认范围为0-100%。也可用一个长度为2的向量控制初始范围,如c(30,70)显示初始30-70%。If&dataZoom=TRUE,
the default range is 0-100%. You can assign a vector with length of
2 to&dataZoom&to
control the initial range. E.g.,c(30,70)&means
from 30% to 70% at the initial view.
dataRange:
数据范围漫游范围,默认不打开。如要打开,设置dataRange=c(高值标签,低值标签)
The range to zoom the data. Default to FALSE. Set
dataRange=c(High
value label,Low
value label) to enable dataRange.
splitNumber:
如打开数据漫游,可指定数据范围切分段数,默认为连续漫游轴(0)。在直方图里,如设定splitNumber,则将数据切分成splitNumber个块。When
dataRange is on, assign splitNumber to cut the range into discrete
sections. Default to 0 (continuous range). In histogram, if
splitNumber is set, the y variable will be cut into splitNumber
dataRangePalette:
如打开数据漫游,可单独指定漫游色板(同palette功能),否则采用Echarts默认值。You can independently
assign palettes to dataRange (similar to overall palette). Default
to NULL (applies echarts defaults).
xAxis: x轴参数,写作一个列表,默认为list(lab=NULL,color=NULL,splitLine=T,banded=F,rotate=0),lab为标题,color为颜色,splitLine为分割线,banded为间隔区块,rotate为轴标签旋转(-90
~ 90)。x Axis parameters in a list, default
to&list(lab=NULL,color=NULL,splitLine=T,banded=F,rotate=0).
yAxis: y轴参数,参考xAxis。parameters of y Axis. Refer
xlab: 也可忽略xAxis项,单独通过xlab指定x轴标题。如xAxis[['lab']]和xlab冲突,取xlab。You
can also omit xAxis, directly assign xAxis title. xlab has a higher
priority than&xAxis[['lab']].
ylab: 也可忽略yAxis项,单独通过ylab指定y轴标题。如yAxis[['lab']]和ylab冲突,取ylab。You
can also omit yAxis, directly assign yAxis title. ylab has a higher
priority than&yAxis[['lab']].
xAxis1: 次级x轴参数,多系列数据时有效。写作一个列表,默认为list(lab=NULL,series=NULL,reverse=F,color=NULL,splitLine=T,banded=F,rotate=0)。其中,series指定放于次坐标轴的数据系列,可写系列名或序号,如c(1,2)或c('male','female');reverse设为TRUE时将数据颠倒显示。Secondary
x axis, effecitve only if there are multiple series. Written in a
list, default tolist(lab=NULL,series=NULL,reverse=F,color=NULL,splitLine=T,banded=F,rotate=0).&series&set
which series to put on secondary x-axis, which can be either a name
vector or an index vector, e.g., c(1,2) or c('male','female'). The
data is fliped up when&reverse&is
yAxis1:级次y轴参数,参考xAxis1。
xlab1:次级x轴标题,优先级高于xAxis1列表中的lab项。Title of
secondary x-axis, with higher priority
than&lab&in
xAxis1 list,
ylab1:次级y轴标题,优先级高于yAxis1列表中的lab项。Title of
secondary y-axis, with higher priority
than&lab&in
yAxis1 list,
xyflip: 默认FALSE,是否翻转坐标轴。Flip x,y-axies. Default
AxisAtZero: 默认FALSE,坐标轴是否交叉于零点。Axes cross at
zero. Default to FALSE.
scale: 默认TRUE,是否基于最大、最小值调整坐标尺度。Rescale the axes
based on min and max values. Default to TRUE.
调色板。默认aetnagreen。Overall palette. Default to 'aetnagreen'.
种类 Palette names:
Aetna palettes: 可用
Including&"aetnagreen", "aetnablue",
"aetnaviolet", "aetnaorange", "aetnateal", "aetnacranberry"
RColorBrewer palettes: 可用
Including "BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu",
"RdYlGn", "Spectral", "Accent", "Dark2", "Paired", "Pastel1",
"Pastel2", "Set1", "Set2", "Set3", "Blues", "BuGn", "BuPu", "GnBu",
"Greens", "Greys", "Oranges", "OrRd", "PuBu", "PuBuGn", "PuRd",
"Purples", "RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr",
ggthemes palettes: "calc",
"economist", "economist_white", "economist_stata","excel",
"exel_fill", "excel_old", "excel_new", "few", "fivethirtyeight",
"gdocs", "pander", "tableau", "stata",
"stata1","stata1r","statamono", "tableau20", "tableau10medium",
"tableaugray", "tableauprgy", "tableaublrd", "tableaugnor",
"tableaucyclic", "tableau10light", "tableaublrd12",
"tableauprgy12", "tableaugnor12","hc","darkunica",
"solarized","solarized_red", "solarized_yellow",
"solarized_orange","solarized_magenta","solarized_violet",
"solarized_blue", "solarized_cyan", "solarized_green", "wsj",
"wsj_rgby", "wsj_red_green", "wsj_black_green", "wsj_dem_rep",
"colorblind", "trafficlight"
其他Other palettes: "rainbow",
"terrain", "topo", "heat", "cm"
用法 Usage:
可以不设置,使用函数默认。Do not set the
value and function defaults will be loaded
可使用Echarts默认(palette=NULL)。Set&palette=NULL&to
apply Echarts defaults
可指定上述任何一种色板(palette=palette_name)。Set&palette=palette_name&to
assign any palette listed above
规定色板的同时加上个数限定,限定取色个数,如palette="calc(3)",会从calc色板中随机取3种色彩。Set&palette=palette
name(number)&to restrain number of colors
within the palette (e.g.,palette="calc(3)"&picks
3 colors out of "calc"&randomly)
可以palette=c(色1,
色2, 色3, …)自定义色板向量(名称或hex式)。可以用colors()函数查看所有可用的色名。
tooltip: 默认TRUE,鼠标指针特效。Mouse
tip effects swtich. Default to TRUE.
图例,默认TRUE。可以写作一个长度为2的列表,list(mode="single/multiple",select=选中的系列)。如list(mode="single",select="Male")表示单选,初始仅选中显示Male系列。legend=FALSE则不显示图例。Whether
to show the legend. Default to TRUE. Can also be a list length
2:list(mode='single/multiple',select=vector(...)).
E.g.,&list(mode='single',select='Male')&means
singular choice, with series 'Male' selected at the initial
view.&legend=FALSE&closes
toolbox: 默认TRUE,是否显示工具箱。Echarts
Tool box switch. Default to TRUE.
calculable:
默认TRUE,是否支持拖曳重算(Echarts专利) Calculable switch (Echarts patent).
默认FALSE,是否显示为静态图。renderAsImage switch. Deafult to FALSE.
markLine: 显示标线,默认不显示。格式写作一个4或8列的数据框或矩阵 Show markline, default to
NULL. The grammar is a data.frame or matrix with 4 or 8
缩略格式 Short form :
series name/index *
Light effect
String or number
String / NA
min/max/average/lm
TRUE / FALSE
完整格式 Full form :
series name/index *
Light effect
String or number
TRUE / FALSE
例子 Examples
如t(c('male',NA,'average',F))或t(c(1,NA,'average',F))都可表示male数据系列平均值标线,只用于line,
linesmooth, bar, scatter, bubble。lm可出线性回归标线,只用于散点或气泡图。如t(c(1,NA,'average',T))则表示male系列开启炫光特效。E.g.,
both&t(c('male',NA,'average',F))&and&t(c(1,NA,'average',F))&refer
to an average markline of the series 'male', only available for
line, linesmooth, bar, scatter, bubble charts. 'lm' refers to
linear regresson markline which is only available for scatters and
bubbles.&t(c(1,NA,'average',T))&opens
light effects of series 'male'.
如t(c('male',NA,100,0,5,100,5,F))表示在'male'数据系列中画一条经过P0(0,5)和P1(100,5)的直线。E.g.,t(c('male',NA,100,0,5,100,5,F))&refers
to a markline through P0(0,5) and P1(100,5) as of sereis 'male'.
在line, bar, k, scatter图中,'P0 x','P0 y','P1 x','P1
y'均被理解为直角坐标系的定位。在map中,这些坐标值必须写作经纬度。&t(c('male',NA,100,0,5,100,5,T))可打开male系列的炫光特效。
In line, bar, k and scatter charts, 'P0 x','P0 y','P1 x','P1 y' are
comprehended as coordinates. In map charts, these coordinates
should be lattitudes and longitudes.&t(c('male',NA,100,0,5,100,5,T))&opens
light effects of series 'male'.
markLinesmooth: 如要用平滑标线,可用markLinesmooth替代markLine。语法完全一样。Used this
instead of&markLine&for
smooth marklines with totally identical grammar.
markPoint: 显示标注点,默认不显示。格式写作一个4或6列的数据框或矩阵 Show markpoints, default
to NULL. The grammar is a data.frame or matrix with 4 or 6
缩略格式 Short form :
series name/index *
Point name
Point type
Light effect
String or number
String / NA
TRUE / FALSE
完整格式 Full form :
series name/index *
Point name
Light effect
String or number
String / NA
TRUE / FALSE
例子 Examples
如t(c('male',NA,'min',F))或t(c(1,NA,'min',F))都可表示male数据系列最小值标注,只用于line,
linesmooth, bar, scatter, bubble。t('male',NA,'min',T)则表示male系列开启炫光特效。E.g.,
both&t(c('male',NA,'min',F))and&t(c(1,NA,'min',F))&refer
to a min markpoint of the series 'male', only available for line,
linesmooth, bar, scatter, bubble
charts.&t(c('male',NA,'min',T))&opens
light effects of series 'male'.
如t(c('male',NA,100,0,5,F))表示在'male'数据系列中标注点P(0,5)。E.g.,&t(c('male',NA,100,0,5,F))&refers
to a markpoint at P(0,5) as of sereis 'male'. 在line, bar, k,
scatter图中,'P x','P y', ...
均被理解为直角坐标系的定位。在map中,这些坐标值必须写作经纬度。&t(c('male',NA,100,0,5,T))可打开male系列的炫光特效。
In line, bar, k and scatter charts, 'P x','P y',... are
comprehended as coordinates. In map charts, these coordinates
should be lattitudes and longitudes.&t(c('male',NA,100,0,5,T))&opens
light effects of series 'male'.
theme: 主题元素设置,语法为theme=list(backgroundColor=color
name/value, borderColor=color name/value,
borderWidth=1),color默认均为NULL,width默认为1。
&Examples 示例
以下为静态图示例,真实d3-js效果请前往&&&&&&&&
#Global settings
Sys.setlocale("LC_CTYPE","Chs")
source("~/Github/recharts/R/echartR.R")
knitr::opts_chunk$set(message=FALSE,warning=FALSE,results='asis')
Scatter 散点图
Mono-series Scatter 单系列散点图
没有数据系列,因此指定显示第1个系列的均数线(markLine=c(1,NA,'average',F))。
echartR(data = iris, x = ~Sepal.Width, y = ~Petal.Width,
type = 'scatter', palette='solarized_magenta',
title = 'Scatter - Sepal Width vs Petal Width',
subtitle = "(source: iris)", xlab = 'Sepal Width', ylab = 'Petal Width',
markLine=t(c(1,'Mean',"average",F)))
Multi-series Scatter 多系列散点图
指定series,且显示范围从零点开始(scale=FALSE)。在第2个数据系列(versicolor)中打开最大(max)、最小(min)、均线(average)三根标线;在第1、2、3数据系列中分别标注max、min、max点,且打开第3个系列的眩光特效(markPoint=rbind(c(1,'Max','max',F),c(2,'Min','min',F),
c(3,'Max','max',T)))。
通过xAxis和yAxis设置,去掉了所有纵轴。
echartR(data = iris, x = ~Sepal.Width, y = ~Petal.Width, series = ~Species,
type = 'scatter', palette='wsj_dem_rep', symbolList='circle',
scale=F, xAxis = list(lab='Sepal Width', color='darkgray'),
yAxis = list(lab='Petal Width',color='none'),
title = 'Scatter - Sepal Width vs Petal Width, by Species',
subtitle ='(source: iris)',
markLine=rbind(c(2,'Mean','average',F),c('versicolor','Maximum','max',F),
c(2,'Minimum','min',F)),
markPoint=rbind(c(1,'Max','max',F),c(2,'Min','min',F), c(3,'Max','max',T)))
使用三套非标准图形(箭头、心形、八角星)区分数据系列(c('arrow','heart','star8'))。命令指定随机选择excel_old色版中的1种颜色,但由于数据集有3个水平(series),颜色个数限制在执行中被忽略。
同时拟合3条回归线(markLine列表写作short form,类型指定为’lm’,并开启炫光特效)。
echartR(data = iris, x = ~Sepal.Width, y = ~Petal.Width, series = ~Species,
type = 'scatter', palette='excel_old(1)',
symbolList=c('arrow','heart','star8'),
title = 'Scatter - Sepal Width vs Petal Width, by Species',
subtitle = '(source: iris)', xlab = 'Sepal Width', ylab = 'Petal Width',
markLine = rbind(c('setosa','Linear Reg Coef','lm',T),
c(2,'Linear Reg Coef','lm',T), c(3,'Linear Reg Coef','lm',T)))
大规模散点图(2000个点以上)同样可以秒级出图(但html文件会变得很大)。
x &- rnorm(2001)*2
e &- vector()
for (i in 1:2001)
e &- c(e,rnorm(1,0,x[i]+abs(min(x))))
df &- data.frame(x, sin=sin(x)+e/20, cos=cos(x)+e/20)
df &- melt(df,id="x")
echartR(df,x=~x,y=~value,series=~variable,type='scatter',
palette='wsj_red_green',symbolList='circle', AxisAtZero=F,
title='Scatter of 2,001 points', subtitle = 'Large-scale scatter')
Bubble 气泡图
气泡图同样来源于散点图。type改为bubble即可,如不指定weight变量,函数默认指定y为气泡权重。
Mono-series Bubble 单系列气泡图
echartR(data = iris, x = ~Sepal.Width, y = ~Petal.Width, weight = ~Petal.Length,
type = 'bubble', palette='solarized_cyan',
title = paste("Bubble - Sepal Width vs Petal Width,",
"weighed by Petal Length"),
subtitle = '(source: iris)',
xlab = 'Sepal Width', ylab = 'Petal Width')
Multi-series Bubble 多系列气泡图
用symbolList=c('circle','emptyCircle')设置第1个数据系列为实心圆、剩下的数据系列以空心圆作为标志图形。palette设置为tableauGnOr(3),只随机取该色板的3种颜色。
再做一个基于全集的线性回归(lm())。由于无法显示在任何一个系列上,因此echartR生成了一个新的数据系列。前一节多系列散点图中,三个系列Sepal
Width与Petal Width都正相关,而本例中,合并起来两者却呈负相关。这个例子形象地展示了分层分析的重要性。
fit &- lm(Petal.Width~Sepal.Width,iris)
pred &- data.frame(Sepal.Width=c(min(iris$Sepal.Width),max(iris$Sepal.Width)))
yhat &- round(predict(fit,pred),2)
echartR(data = iris, x = ~Sepal.Width, y = ~Petal.Width,
weight = ~Petal.Length, series = ~Species,
symbolList=c('emptyCircle','circle'),
type = 'bubble', palette='tableaugnor(4)',
title = paste('Bubble - Sepal Width vs Petal Width, by Species,',
'weighed by Petal Length'),
subtitle = '(source: iris)', xlab = 'Sepal Width', ylab = 'Petal Width',
markLine=t(c('Reg Coef.','slope',round(fit$coefficients[[2]],2),
pred[1,1],yhat[[1]],pred[2,1],yhat[[2]],F)))
Column 柱图
先生成一个汇总数据集dtiris。
library(reshape2)
dfiris &- iris
dfiris$id &- row.names(iris)
dfiris &- melt(dfiris,id=c("Species","id"))
names(dfiris) &- c("Species","id","Param","Value")
dtiris &- dcast(dfiris[,c(1,3,4)],Species+Param~.,value.var="Value",mean)
names(dtiris) &- c("Species","Param","Mean")
knitr::kable(dcast(dtiris,Param~Species,sum,value.var="Mean"),
format='html',caption="Table: Mean of parameters (iris)")
Table: Mean of parameters (iris)
versicolor
Sepal.Length
Sepal.Width
Petal.Length
Petal.Width
Tiled Column 平铺柱图
echartR(data = dtiris, x = ~Param, y = ~Mean,
series = ~Species,
type = 'bar', palette='fivethirtyeight',
title = "Column - Parameter Mean by Species",
subtitle = '(source: iris)',legend_pos=3,
xlab = 'Parameter', ylab = 'Mean')
Stacked Column 堆积柱图
echartR(data = dtiris, x = ~Param, y = ~Mean,
series = ~Species, stack=T,
type = 'bar', palette='pander',
title = "Column - Parameter Mean by Species",
subtitle = '(source: iris)',
xlab = 'Parameter', ylab = 'Mean', legend_pos=3)
堆积与否,也可以简单地通过工具栏的平铺和堆积按钮切换。非常强大。
条图和柱图的区别只在于xyflip开关选项。
Tiled Bar 平铺条图
echartR(data = dtiris, x = ~Species, y = ~Mean, series = ~Param,
type = 'bar', palette='stata1', xyflip=T,
title = 'Species-specific Mean by Parameters',
subtitle = '(source: iris)', legend_pos=3,
xlab = 'Species', ylab = 'Mean')
Stacked Bar 堆积条图
palette设为calc的随机4种颜色。打开stack (stack=TRUE)。
echartR(data = dtiris, x = ~Param, y = ~Mean,
series = ~Species, stack=T, xyflip=T,
type = 'bar', palette='calc(5)',
title = 'Parameter Mean by Species',
subtitle = '(source: iris)',
xlab = 'Parameter', ylab = 'Mean', legend_pos=3)
Histogram 直方图
直方图是柱图的一种特例,只需要指定y变量。可通过splitNumber指定直方数(默认9)。xyflip设为TRUE则成为等价的横条图。
echartR(airquality, y=~Temp, type='histogram', splitNumber=13,
palette='pastel2', title='Histogram of temperature',
subtitle = '(source: airquality)')
用mtcars作为作图数据集。
dtcars &- mtcars
dtcars$car &- row.names(dtcars)
dtcars$transmission &- as.factor(dtcars$am)
levels(dtcars$transmission) &- c("Automatic","Manual")
dtcars$cylinder &- as.factor(dtcars$cyl)
dtcars$carburetor &-as.factor(dtcars$carb)
echartR(dtcars, x = ~transmission,
y = ~car, type='pie',
palette='darkunica',
title='Number of cars by transmission',
subtitle = '(source: mtcars)')
环形图是饼图的变形,只需将type改为’ring’。Echarts中只需要把饼图的半径参数扩展为包含内、外径的长度为2的向量即可。
echartR(dtcars, x = ~cylinder,
y = ~car, type='ring',
palette='hc', title='Number of Cylinders',
subtitle = '(source: mtcars)')
Rose Nightingale玫瑰图
echartR(dtcars, x = ~cylinder,
y = ~car, type='rose',
palette='colorblind', title='Number of Cylinders',
subtitle = '(source: mtcars)')
Unstacked Line 平铺线图
打开数据缩放,设置初始显示30-70%(dataZoom=c(30,70))。
airquality$Date &- strptime(paste(2015,airquality$Month,airquality$Day,sep="-"),
format="%F", tz="Asia/Taipei")
airquality$strDate &- with(airquality,paste(2015,Month,Day,sep="-"))
airquality$TempG &- cut(airquality$Temp,breaks=c(0,60,70,80,100))
echartR(airquality, x = ~Day, y= ~Wind, series=~Month, type='line',
dataZoom=c(30,70), symbolList='none',
palette='tableauBlRd', xlab = 'Days', ylab = 'Wind',
title='Day-specific Wind by month (airquality)')
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。

我要回帖

更多关于 王者荣耀怎么退出 的文章

 

随机推荐