Skip to content

Commit

Permalink
fix(runtime): pass style to shape function
Browse files Browse the repository at this point in the history
  • Loading branch information
pearmini committed Jun 23, 2022
1 parent 03c608d commit 544c6cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/runtime/plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,12 @@ function createShapeFunction(
const { defaultShape, data } = state;
const point2d = data.map((d) => d.points);
const { theme, coordinate } = view;
const { style } = mark;
return (data, index) => {
const { shape, points, ...v } = data;
const value = { ...v, index };
const normalizedShape = normalizeOptions(shape || defaultShape);
const shapeFunction = useShape(normalizedShape);
const shapeFunction = useShape({ ...normalizedShape, ...style });
return shapeFunction(points, value, coordinate, theme, point2d);
};
}
Expand Down
2 changes: 2 additions & 0 deletions src/shape/interval/colorRect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export type ColorRectOptions = {
* Calc arc path based on control points directly rather startAngle, endAngle, innerRadius,
* outerRadius. This is not accurate and will cause bug when the range of y scale is [1, 0]
* for grid geometry.
* @todo Radius in rect.
*/
export const ColorRect: SC<ColorRectOptions> = (options) => {
// Render border only when colorAttribute is stroke.
Expand Down Expand Up @@ -62,6 +63,7 @@ export const ColorRect: SC<ColorRectOptions> = (options) => {
innerRadius: dist(p3, center),
outerRadius: dist(p0, center),
};
console.log(radius);
const path = arc().cornerRadius(radius as number);

return select(new Path({}))
Expand Down
4 changes: 3 additions & 1 deletion src/spec/scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export type ScaleTypes =
export type BaseScale<T extends ScaleTypes, O> = {
type?: T;
palette?: Palette;
guide?: Record<string, any>; // @todo
// @todo More specific options.
// @todo Remove null as it can be stored in JSON.
guide?: Record<string, any> | null;
field?: string | string[];
independent?: boolean;
zero?: boolean;
Expand Down

0 comments on commit 544c6cb

Please sign in to comment.