-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom series enhancement (for-next) #12775
Conversation
…same as cartesian axis.
…in custom series.
…en even thought merging children).
Thanks for your contribution! The pull request is marked to be |
Somthing more discussion about during callbackThe proposed during callback may enable some new power customzation with animation.
Note that: For users, in each frame, users usually need to:
For echarts, we need to:
The current API is implemented in the follow way: renderItem(params, api) {
var abcVal = makeNextAbcValue(params, api);
return {
type: 'polygon',
shape: {
abc: abcVal,
points: calculatePolygonPoints(abcVal)
// Make the built-in interpolate to be adapted on "abc".
$transition: 'abc'
},
during: function (apiDuring) {
var abcVal = apiDuring.getShape('abc');
var points = calculatePolygonPoints(abcVal);
apiDuring.setShape('points', points);
}
}
} Note that it provides those "method" to for users to read and write the values in the "during callback": interface DuringAPI {
// currently only transform props
// (x, y, scaleX, scaleY, originX, orignY, rotation)
// are available here. Other attributes are not supported
// until really needed one day.
setAttr(key: TransformProps, val: unknown): void;
getAttr(key: TransformProps): unknown;
// get and set and any props in "shape".
// No need to make a travel since it does not support
// to input a dictionary object.
// We do not restrict the shape props types because it
// should be able to customized by users and the result
// of `renderItem` also does not restrict the shape props.
setShape(key: string, val: unknown): void;
getShape(key: string): unknown;
// get and set and any props in "style".
// No need to make a travel since it does not support
// to input a dictionary object.
// We do not restrict the style props types because it
// The result of `renderItem` also does not restrict the
// style props.
setStyle(key: string, val: unknown): void;
getStyle(key: string): unknown;
// If `setStyle` called, echarts will auto call `durty()`
// internally for this element.
// Otherwise of only `setAttr` or `setShape` called,
// echarts will only call `markRedraw()` internally
// for this element.
} Now could we think of that:
|
I will prefer Also, can parameter be an object? In the case want to update multiple multiple transform properties: setTransform({ x: Math.sin(angle), y: Math.cos(angle), rotation: angle }); It will be simpler than: setTransform('x', Math.sin(angle));
setTransform('y', Math.cos(angle));
setTransform('rotation', angle); |
I think is OK to change But I am not sure about support "object input" in those setter API. The reason is:
during: function (apiDuring) {
var points = makeShapePoints(
api, valOnRadius, apiDuring.getShape('valOnAngle')
);
apiDuring.setShape('points', points);
} during: function (apiDuring) {
var points = makePionterPoints(params, apiDuring.getShape('polarEndRadian'));
apiDuring.setShape('points', points);
} during: function (apiDuring) {
apiDuring.setStyle('text', makeText(apiDuring.getShape('valOnRadian')));
} during: function (apiDuring) {
var currContentColor = getColorInTransition(apiDuring, 'content');
apiDuring.setStyle('fill', currContentColor);
} during: function (apiDuring) {
var points = makeShapePoints(
params,
apiDuring.getShape('widthRadius'),
apiDuring.getShape('startRadius'),
apiDuring.getShape('endRadian')
);
apiDuring.setShape('points', points);
} In these cases above, "object input" does not help during: function (apiDuring) {
var iValOnAngle = apiDuring.getShape('valOnAngle');
var point = makeLabelPosition(api, valOnRadius, iValOnAngle);
apiDuring
.setTransform('x', point[0])
.setTransform('y', point[1])
.setStyle('text', getText(iValOnAngle));
} during: function (apiDuring) {
var endRadian = apiDuring.getShape('endRadian');
var point = makeLabelPosition(
params,
apiDuring.getShape('widthRadius'),
apiDuring.getShape('startRadius'),
endRadian
);
apiDuring.setTransform('x', point[0]).setTransform('y', point[1]);
apiDuring.setStyle('text', makeText(endRadian));
} In these cases above, "object input" helps, but not a significant improve: during: function (apiDuring) {
var endRadian = apiDuring.getShape('endRadian');
var point = makeLabelPosition(
params,
apiDuring.getShape('widthRadius'),
apiDuring.getShape('startRadius'),
endRadian
);
apiDuring.setTransform({ x: point[0], y: point[1] });
apiDuring.setStyle('text', makeText(endRadian));
}
|
…e name from "setAttr" to "setTransform".
# Conflicts: # src/util/graphic.ts
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
Hello, may I ask that if I just want to emphasis the text 'xxx' without emphasizing its parent rect, how can I do? Waiting for your reply with excited ~ |
Brief Information
This pull request is in the type of:
What does this PR do?
emphasis
setting.during
, and "enter"/"leave" animation.textContent and textConfig
emphasis config
Transform attr
clipPath
during
transition config
enterFrom laveTo animation config
$mergeChildren
By default, group children will be merged by index.
Users can also specify
$mergeChildren: 'byName'
to merge children by name on each child element.Merge children will happen when each time
renderItem
called. For example, if there is some conditionvariables in
renderItem
which results in different returned children.Deprecated and break change
api.style
andapi.styleEmphasis
are deprecated.api.style
andapi.styleEmphasis
are slightly different (impossible to totally compat).position
,scale
,origin
are deprecated.diffChildrenByName
is deprecated.Others
Related test cases or examples to use the new APIs
<test/custom-text-content.html>
<test/custom-text-transition.html>
Related issues
#5988