ECharts日历格的样式怎么设置
2018-10-18 10:36 更新
calendar.itemStyle | Object
设置 ECharts 日历格的样式。
calendar.itemStyle.normal | Object
通过 normal 状态设置日历格样式。
calendar.itemStyle.normal.color | Color
[ default: #fff ]
设置日历格图形的颜色。
颜色可以使用 RGB 表示,比如 'rgb(128, 128, 128)',如果想要加上 alpha 通道表示不透明度,可以使用 RGBA,比如 'rgba(128, 128, 128, 0.5)',也可以使用十六进制格式,比如 '#ccc'。除了纯色之外颜色也支持渐变色和纹理填充。
// 线性渐变,前四个参数分别是 x0, y0, x2, y2, 范围从 0 - 1,相当于在图形包围盒中的百分比,如果 globalCoord 为 `true`,则该四个值是绝对的像素位置 color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: 'red' // 0% 处的颜色 }, { offset: 1, color: 'blue' // 100% 处的颜色 }], globalCoord: false // 缺省为 false } // 径向渐变,前三个参数分别是圆心 x, y 和半径,取值同线性渐变 color: { type: 'radial', x: 0.5, y: 0.5, r: 0.5, colorStops: [{ offset: 0, color: 'red' // 0% 处的颜色 }, { offset: 1, color: 'blue' // 100% 处的颜色 }], globalCoord: false // 缺省为 false } // 纹理填充 color: { image: imageDom, // 支持为 HTMLImageElement, HTMLCanvasElement,不支持路径字符串 repeat: 'repeat' // 是否平铺, 可以是 'repeat-x', 'repeat-y', 'no-repeat' }
calendar.itemStyle.normal.borderColor | Color
[ default: '#ccc' ]
设置日历格图形的描边颜色。支持的颜色格式同 color,不支持回调函数。
calendar.itemStyle.normal.borderWidth | number
[ default: 1 ]
设置日历格的描边线宽。为 0 时无描边。
calendar.itemStyle.normal.borderType | string
[ default: 'solid' ]
设置日历格中柱条的描边类型,默认为实线,支持 'solid', 'dashed', 'dotted'。
calendar.itemStyle.normal.shadowBlur | number
设置日历格图形阴影的模糊大小。
该属性配合 shadowColor,shadowOffsetX, shadowOffsetY 一起设置图形的阴影效果。
示例:
{ shadowColor: 'rgba(0, 0, 0, 0.5)', shadowBlur: 10 }
calendar.itemStyle.normal.shadowColor | Color
设置日历格阴影颜色。支持的格式同 color。
calendar.itemStyle.normal.shadowOffsetX | number
[ default: 0 ]
设置日历格阴影在水平方向上的偏移距离。
calendar.itemStyle.normal.shadowOffsetY | number
[ default: 0 ]
设置日历格阴影在垂直方向上的偏移距离。
calendar.itemStyle.normal.opacity | number
设置日历格图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
例如:
calendar: [{ itemStyle: { normal: { color: '#fff', borderWidth: 1, borderColor: '#ccc' } } }]
以上内容是否对您有帮助:
更多建议: