-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(react-charting): Support marker shapes for scatter chart #34656
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
base: master
Are you sure you want to change the base?
feat(react-charting): Support marker shapes for scatter chart #34656
Conversation
📊 Bundle size report✅ No changes found |
packages/charts/react-charting/src/components/ScatterChart/ScatterChart.base.tsx
Outdated
Show resolved
Hide resolved
change/@fluentui-react-charting-27a887a9-dd1e-400c-b696-da3e3c231c33.json
Show resolved
Hide resolved
...ages/charts/react-charting/src/components/LineChart/__snapshots__/LineChartRTL.test.tsx.snap
Outdated
Show resolved
Hide resolved
packages/charts/react-charting/src/components/ScatterChart/ScatterChart.base.tsx
Outdated
Show resolved
Hide resolved
packages/charts/react-charting/src/components/Legends/shape.tsx
Outdated
Show resolved
Hide resolved
height={14} | ||
viewBox={'-1 -1 14 14'} | ||
{...getSecureProps(svgProps)} | ||
transform={`rotate(${shape === Points[Points.diamond] ? 45 : shape === Points[Points.pyramid] ? 180 : 0}, 0, 0)`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, since we have the exact shapes this transform was changing the legend shape
return '-1 -1 14 14'; | ||
} | ||
// For plotly-based shapes, use centered viewBox | ||
return '-7 -7 14 14'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the plotly shape paths are centrally aligned and thus the view box had to be changed. otherwise the legend container was showing incomplete shapes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the margin and alignment for both old shapres and new shapes same. Other than dottedLine and pyramid, all are plotly provided shapes? What happened to the existing 8 shapes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I have updated all others as they were existing in plotly shapes.
packages/react-examples/src/react-charting/DeclarativeChart/schema/fluent_donut.json
Outdated
Show resolved
Hide resolved
Legend shapes have a special behavior of showing only the border on deselection and filling the entire shape on selection. Do your new shapes have this functionality. |
af6119e
to
81a8169
Compare
c588762
to
55d24dc
Compare
what is the size bump for this PR |
3760311
to
6016492
Compare
Pull request demo site: URL |
@@ -950,7 +959,7 @@ export interface ILegend { | |||
nativeButtonProps?: React_2.ButtonHTMLAttributes<HTMLButtonElement>; | |||
onMouseOutAction?: (isLegendFocused?: boolean) => void; | |||
opacity?: number; | |||
shape?: LegendShape; | |||
shape?: DataPointShape; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
'2.26l-2.26,2.26l2.26,2.26Z', | ||
// Additional shapes | ||
star: 'M1.26,-1.73H5.33L2.03,0.66L3.29,4.53L0,2.14L-3.29,4.53L-2.03,0.66L-5.33,-1.73H-1.26L0,-5.6Z', | ||
hexagram: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all shapes now starting from viewpoint 0,0 to 14,14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no its '-7 -7 14 14'; means the SVG's coordinate system goes from -7 to +7 on both axes, with (0,0) at the center. The previous shapes were not centrally aligned thats why on hover, the line indicating the position was also distorted, starting from left. Now all shapes are centrally aligned.
…ers/srmukher/scatter_marker_shapes
// Warning: (ae-forgotten-export) The symbol "CustomPoints" needs to be exported by the entry point index.d.ts | ||
// | ||
// @public | ||
export type LegendShape = 'default' | 'triangle' | keyof typeof Points | keyof typeof CustomPoints; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type definition was still there in legends.types but the export was overriden in index.ts. Fixed.
@@ -15,9 +15,9 @@ export type { | |||
ILegendsProps, | |||
ILegendsStyles, | |||
IShapeProps, | |||
LegendShape, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why stopped exporting LegendShape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was overriden, fixed.
height: number; | ||
} | ||
|
||
export class ScatterChartShapesExample extends React.Component<{}, IScatterChartShapesState> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add few new shapes to the existing Legends shape example. Want to see how old and new shapes come side by side
shape={legend.shape as LegendShape} | ||
shape={ | ||
String(legend.shape)?.includes('open') | ||
? (String(legend.shape).replace('open', '') as DataPointShape) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This open tolowercase logic should be internal to shape. Not part of legends class.
There are failures in the playwright report https://github.com/microsoft/fluentui-charting-contrib/actions/runs/15779003024 |
In Fluent chart:

In Plotly:
