Comments (2)
The design of this function is support discrete legend bind a glabol scale, followed Grammar Design.
/** spec */
export type IDiscreteLegendSpec = {
// ...others
/**
* scaleName must match the id of the scale configured in **scales**
*/
scaleName?: string;
/**
* After the legend is bound to the scale, the dimension associated with the series data and the legend can be configured through field.
* If the field is not configured, the first item of fields in the domain of scale is used by default
* If the domain of the scale is not dependent on data statistics, series.getSeriesField() is used by default
*/
field?: string;
}
example spec:
const spec = {
type: 'scatter',
data: {
id: 'lineData',
values: [
{ type: 'Nail polish', country: 'Africa', value: -4229, shape: 'A' },
{ type: 'Nail polish', country: 'EU', value: -4376, shape: 'A' },
{ type: 'Eyebrow pencil', country: 'Africa', value: -3932, shape: 'A' },
{ type: 'Eyebrow pencil', country: 'EU', value: -3987, shape: 'A' },
{ type: 'Nail polish', country: 'Africa', value: -4229, shape: 'B' },
{ type: 'Nail polish', country: 'EU', value: -4376, shape: 'B' },
{ type: 'Eyebrow pencil', country: 'Africa', value: -3932, shape: 'B' },
{ type: 'Eyebrow pencil', country: 'EU', value: -3987, shape: 'B' }
]
},
title: {
visible: true,
text: 'Stacked line chart'
},
stack: true,
xField: 'type',
yField: 'value',
seriesField: 'country',
point: {
style: {
fillOpacity: 1,
symbolType: {
scale: 'shapeScale',
field: 'shape'
}
},
state: {
custom_unSelected: {
fillOpacity: 0.5
}
}
},
scales: [
{
id: 'shapeScale',
type: 'ordinal',
domain: [
{
dataId: 'lineData',
fields: ['shape']
}
],
range: ['triangle', 'diamond']
}
],
legends: [
{
visible: true,
position: 'middle',
orient: 'bottom',
offsetX: -100,
item: {
shape: {
style: {
symbolType: 'circle'
}
}
}
},
{
visible: true,
position: 'middle',
orient: 'bottom',
scaleName: 'shapeScale',
item: {
shape: {
style: {
fill: 'red'
}
}
}
}
],
region: [{}],
axes: [
{
orient: 'bottom',
visible: false
},
{
orient: 'bottom',
visible: true,
seriesIndex: [],
type: 'linear',
min: 0,
max: 100
}
]
}
from vchart.
from vchart.
Related Issues (20)
- [Bug] brushEnd + 动态标注, 首次的框不会消失 HOT 1
- [Enhancement] spec 初始化操作从图表实例化中抽离
- [type] export tooltip dimension event types
- [Bug] 图表 resize 会调用两次渲染
- [Bug] Error: `No matching version found for @visactor/[email protected].` HOT 1
- [Bug] player layout error HOT 1
- [Bug] outerRadius 小于某个值的时候,0值的label就不展示了,但是如果不是0值,就算很小很小也能展示出来
- [Bug] legend 文字过长省略显示异常
- [Feature] 雷达图绘图区过小是,标签折叠避免文字截断
- [Bug] lineDash 配置function,在仅有一段时报错(面积图)
- [Feature] 图表支持渐变(字符串形式)
- [Bug] 纵轴重叠时不会自动应用最宽的轴宽度
- [Bug] Android device selects all when the content of setSelected is undefined HOT 2
- [Feature] 图例和 tooltip shape 样式支持配置跟随面积图的 fill 或者 stroke HOT 1
- [Bug] 扩展mark执行动画时某些数据下会跳帧
- [Size] duplicated code in umd bundle
- [API] add api of brush clear event
- [API] zoomIn and zoomOut api of brush component
- [Demo] Timeline Chart Demo
- [Feature] 支持阿里系小程序如钉钉、支付宝
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vchart.