borderRadius: 5
},
data: [ //存放自己的数据
{ value: 20, name: ‘云南’ },
{ value: 26, name: ‘北京’ },
{ value: 24, name: ‘山东’ },
{ value: 25, name: ‘河北’ },
{ value: 20, name: ‘江苏’ },
{ value: 25, name: ‘浙江’ },
{ value: 30, name: ‘四川’ },
{ value: 42, name: ‘湖北’ }
],
label: { // label对象用于修饰图表中的字体
fontSize: 12,
},
labelLine: { // labelLine中注释的线
length: 6,
length2: 8 //其实饼状图上默认有两条注释线引申出来控制线的长短
}
}
],
yAxis为y轴;xAxis为x轴
grid绘图网格
legend图例组件
如下图所示:
柱状图
===
插入本案例中的代码如下:
// 柱状图
(function() {
// 把柱形图中的效果放在一个变量中使用时引用
var item = {
value: 1200,
// itemStyle是对柱子样式进行修改
itemStyle: {
color: ‘#254065’
},
// 当鼠标在柱子上没有高光效果
emphasis: {
itemStyle: {
color: ‘#254065’
}
},
// 当鼠标经过提示框中没有提示效果
tooltip: {
extraCssText: ‘opacity:0’
}
};
var myChart = echarts.init(document.querySelector(“.bar”));
var option = {
color: new echarts.graphic.LinearGradient(
// (x1,y2) 点到点 (x2,y2) 之间进行渐变
0, 0, 0, 1, [
{ offset: 0, color: ‘#00fffb’ }, // 0 起始颜色
{ offset: 1, color: ‘#0061ce’ } // 1 结束颜色
]
),
tooltip: {
trigger: ‘item’,
},
grid: {
top: “3%”,
left: ‘0%’,
right: ‘3%’,
bottom: ‘3%’,
containLabel: true,
//
show: true,
borderColor: ‘rgba(0, 240, 255, 0.3)’
},
xAxis: [{
type: ‘category’,
data: [‘上海’, ‘广州’, ‘北京’, ‘深圳’, ‘合肥’, ‘’, ‘…’, ‘’, ‘杭州’, ‘厦门’, ‘济南’, ‘成都’, ‘重庆’],
// 刻度设置
axisTick: {
// true 图形在刻度中间
alignWithLabel: false,
show: false // 不出现刻度
},
axisLabel: {
color: “#4c9bfd”
},
// x坐标轴颜色设置
axisLine: {
lineStyle: {
color: ‘rgba(0, 240, 255, 0.3)’,
}
}
}],
yAxis: [{
type: ‘value’,
// 刻度设置
axisTick: {
// true 图形在刻度中间
alignWithLabel: false,
show: false // 不出现刻度
},
axisLabel: {
color: “#4c9bfd”
},
// x坐标轴颜色设置
axisLine: {
lineStyle: {
color: ‘rgba(0, 240, 255, 0.3)’,
}
}
}],
series: [{
name: ‘Direct’,
type: ‘bar’,
barWidth: ‘60%’,
data: [2100, 1900, 1700, 1560, 1400, item,
item,
item,
900, 750, 600, 480, 240
]
}]
};
myChart.setOption(option);
// 4.图标也可以自适应我们的屏幕
window.addEventListener(“resize”, function() {
myChart.resize();
});
})();
itemStyle:
itemStyle: { // itemStyle是对柱子样式进行修改
color: ‘#254065’
},
emphasis:
emphasis: { // 当鼠标在柱子上没有高光效果
itemStyle: {
color: ‘#254065’
}
},
柱状图中的渐变效果:
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1, [ // (x1,y2) 点到点 (x2,y2) 之间进行渐变
{ offset: 0, color: ‘#00fffb’ }, // 0 起始颜色
{ offset: 1, color: ‘#0061ce’ } // 1 结束颜色
]
)
grid系列之刻度线:
grid: {
top: “3%”,
left: ‘0%’,
right: ‘3%’,
bottom: ‘3%’,
containLabel: true, // 刻度线出现
show: true, //边框x轴y轴的出现
borderColor: ‘rgba(0, 240, 255, 0.3)’ //边框x轴y轴的颜色
}
xAxis系列参数:
xAxis: [{
type: ‘category’,
data: [‘上海’, ‘广州’, ‘北京’, ‘深圳’, ‘合肥’, ‘’, ‘…’, ‘’, ‘杭州’, ‘厦门’, ‘济南’, ‘成都’, ‘重庆’],
axisTick: {// 刻度设置
alignWithLabel: false, // true 图形在刻度中间
show: false // 不出现刻度
},
axisLabel: { //x轴的颜色
color: “#4c9bfd”
},
axisLine: { // x坐标轴颜色设置
lineStyle: {
color: ‘rgba(0, 240, 255, 0.3)’,
}
}
}]
折线图
===
插入本案例中的代码如下:
// 折线图
(function() {
// 准备数据
var data = {
year: [
[24, 40, 101, 134, 90, 230, 210, 230, 120, 230, 210, 120],
[40, 64, 191, 324, 290, 330, 310, 213, 180, 200, 180, 79]
],
quarter: [
[23, 75, 12, 97, 21, 67, 98, 21, 43, 64, 76, 38],
[43, 31, 65, 23, 78, 21, 82, 64, 43, 60, 19, 34]
],
month: [
[34, 87, 32, 76, 98, 12, 32, 87, 39, 36, 29, 36],
[56, 43, 98, 21, 56, 87, 43, 12, 43, 54, 12, 98]
],
week: [
[43, 73, 62, 54, 91, 54, 84, 43, 86, 43, 54, 53],
[32, 54, 34, 87, 32, 45, 62, 68, 93, 54, 54, 24]
]
}
var myChart = echarts.init(document.querySelector(“.line”));
var option = {
tooltip: {
trigger: ‘axis’
},
legend: {
textStyle: {
color: ‘#4c9bfd’ // 图例文字颜色
},
right: ‘10%’, // 距离右边10%
// 如果series 里面设置了name,那么此时图里组件的data可以省略!!!
// data: [‘Email’, ‘Union Ads’]
},
grid: {
top: “20%”,
left: ‘3%’,
right: ‘4%’,
bottom: ‘3%’,
show: true, //显示边框
borderColor: ‘#012f4a’, // 边框颜色
containLabel: true
},
xAxis: {
type: ‘category’,
boundaryGap: false, // 去除轴内间距
axisTick: {
show: false // 去除刻度线
},
axisLabel: {
color: ‘#4c9bfd’ // 文本颜色
},
axisLine: {
show: false // 去除轴线
},
data: [‘1月’, ‘2月’, ‘3月’, ‘4月’, ‘5月’, ‘6月’, ‘7月’, ‘8月’, ‘9月’, ‘10月’, ‘11月’, ‘12月’]
},
yAxis: {
type: ‘value’,
axisTick: {
show: false // 去除刻度
},
axisLabel: {
color: ‘#4c9bfd’ // 文字颜色
},
splitLine: {
lineStyle: {
color: ‘#012f4a’ // 分割线颜色
}
}
},
color: [‘#00f2f1’, ‘#ed3f35’], //两条曲线改变颜色
series: [{
name: ‘预期销售额’,
type: ‘line’,
smooth: true,
stack: “总量”,
data: data.year[0]
},
{
name: ‘实际销售额’,
type: ‘line’,
smooth: true,
stack: “总量”,
data: data.year[1]
}
]
};
myChart.setOption(option);
// 4.图标也可以自适应我们的屏幕
window.addEventListener(“resize”, function() {
myChart.resize();
legend系列之改变位置:
legend: {
textStyle: {
color: ‘#4c9bfd’ // 图例文字颜色
},
right: ‘10%’, // 距离右边10%
// data: [‘Email’, ‘Union Ads’]
// 如果series 里面设置了name,那么此时图里组件的data可以省略!!!
}
yAxis系列之splitLine:
yAxis: {
type: ‘value’,
axisTick: {
show: false // 去除刻度
},
axisLabel: {
color: ‘#4c9bfd’ // 文字颜色
},
splitLine: {
lineStyle: {
color: ‘#012f4a’ // 分割线颜色
}
}
}
color图表中的折线线条颜色:
color: [‘#00f2f1’, ‘#ed3f35’], //两条曲线改变颜色
雷达图
===
插入本案例中的代码如下:
// 雷达图
(function() {
var myChart = echarts.init(document.querySelector(“.radar”));
var dataBJ = [
[90, 19, 56, 11, 34]
];
var lineStyle = {
width: 1,
opacity: 0.5
};
var option = {
tooltip: {
show: true,
// 控制提示框组件的显示位置
position: [‘60%’, ‘10%’],
},
legend: {
bottom: 5,
data: [‘Beijing’],
itemGap: 20,
textStyle: {
color: ‘#fff’,
fontSize: 14
},
selectedMode: ‘single’
},
radar: {
center: [‘50%’, ‘50%’],
// radius 外半径(最大的圆)占据容器大小
radius: ‘65%’,
indicator: [
{ name: ‘机场’, max: 100 },
{ name: ‘商场’, max: 100 },
{ name: ‘火车站’, max: 100 },
{ name: ‘汽车站’, max: 100 },
{ name: ‘地铁’, max: 100 }
],
shape: ‘circle’,
// 指示器轴的分割段数
splitNumber: 4,
axisName: {
color: ‘rgb(238, 197, 102)’
},
splitLine: {
// 坐标轴在 grid 区域中的分隔线(圆圈)
lineStyle: {
color: ‘rgba(255, 255, 255, 0.5)’,
}
// 如果说要圆圈渐变的效果就用color数组装不同的颜色
/* color: [
“rgba(238, 197, 102, 0.1)”,
“rgba(238, 197, 102, 0.2)”,
“rgba(238, 197, 102, 0.4)”,
“rgba(238, 197, 102, 0.6)”,
“rgba(238, 197, 102, 0.8)”,
“rgba(238, 197, 102, 1)”
].reverse() */
},
splitArea: {
show: false
},
// axisLine也就是雷达图的分割线也是坐标轴
axisLine: {
show: true,
lineStyle: {
color: ‘rgba(255, 255, 255, 0.5)’
}
}
},
series: [{
name: “北京”,
type: ‘radar’,
// 填充区域的线条颜色
lineStyle: lineStyle = {
normal: {
color: ‘#fff’,
// width: 1
}
},
data: dataBJ,
// data: [[90, 19, 56, 11, 34]],也可以直接这么表达
// symbol 标记的样式(拐点),还可以取值’rect’ 方块 ,‘arrow’ 三角等
symbol: ‘circle’,
// 拐点的大小
symbolSize: 5,
// 小圆点(拐点)设置为白色
itemStyle: {
color: ‘#fff’
},
// 在圆点上显示相关数据
label: {
show: true,
color: ‘#fff’,
fontSize: 10
},
areaStyle: {
opacity: 0.1
},
name: {
// 修饰雷达图文本颜色
textStyle: {
color: ‘#4c9bfd’
}
},
// 区域填充的背景颜色设置
areaStyle: {
color: ‘rgba(238, 197, 102, 0.6)’,
},
}]
};
myChart.setOption(option);
window.addEventListener(“resize”, function() {
myChart.resize();
});
})();
radar系列之splitLine、splitArea、axisLine
radar: {
center: [‘50%’, ‘50%’],
// radius 外半径(最大的圆)占据容器大小
radius: ‘65%’,
indicator: [
{ name: ‘机场’, max: 100 },
{ name: ‘商场’, max: 100 },
{ name: ‘火车站’, max: 100 },
{ name: ‘汽车站’, max: 100 },
{ name: ‘地铁’, max: 100 }
],
shape: ‘circle’,
splitNumber: 4, // 指示器轴的分割段数
axisName: {
color: ‘rgb(238, 197, 102)’
},
splitLine: {
lineStyle: { // 坐标轴在 grid 区域中的分隔线(圆圈)
color: ‘rgba(255, 255, 255, 0.5)’,
}
// 如果说要圆圈渐变的效果就用color数组装不同的颜色
/* color: [
“rgba(238, 197, 102, 0.1)”,
“rgba(238, 197, 102, 0.2)”,
“rgba(238, 197, 102, 0.4)”,
“rgba(238, 197, 102, 0.6)”,
“rgba(238, 197, 102, 0.8)”,
“rgba(238, 197, 102, 1)”
].reverse() */
},
splitArea: {
show: false //grid区域中的分隔区域,默认不显示
},
axisLine: { // axisLine也就是雷达图的分割线也是坐标轴
show: true,
lineStyle: {
color: ‘rgba(255, 255, 255, 0.5)’
}
}
}
series系列之symbol、symbolSize、itemStyle、areaeStyle
series: [{
name: “北京”,
type: ‘radar’,
// 填充区域的线条颜色
lineStyle: lineStyle = {
normal: {
color: ‘#fff’,
// width: 1
}
},
data: [[90, 19, 56, 11, 34]],
symbol: ‘circle’, // symbol 标记的样式(拐点),
//还可以取值’rect’ 方块 ,‘arrow’ 三角等
symbolSize: 5, // 拐点的大小
itemStyle: { // 小圆点(拐点)设置为白色
color: ‘#fff’
},
label: { // 在圆点上显示相关数据
show: true,
color: ‘#fff’,
fontSize: 10
},
areaStyle: {
opacity: 0.1
},
name: {
textStyle: { // 修饰雷达图文本颜色
color: ‘#4c9bfd’
}
},
areaStyle: { // 区域填充的背景颜色设置
color: ‘rgba(238, 197, 102, 0.6)’,
},
}]
饼图之环形图
======
插入本案例中的代码如下:
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点!不论你是刚入门Android开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
label: { // 在圆点上显示相关数据
show: true,
color: ‘#fff’,
fontSize: 10
},
areaStyle: {
opacity: 0.1
},
name: {
textStyle: { // 修饰雷达图文本颜色
color: ‘#4c9bfd’
}
},
areaStyle: { // 区域填充的背景颜色设置
color: ‘rgba(238, 197, 102, 0.6)’,
},
}]
饼图之环形图
======
插入本案例中的代码如下:
最后
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-eTrD9emq-1715346734514)]
[外链图片转存中…(img-7piMM2iy-1715346734515)]
[外链图片转存中…(img-tEHWZfEc-1715346734515)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点!不论你是刚入门Android开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!
如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!