Closed alexeyraspopov closed 2 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/nteract/semiotic/34QYqP8YALsjtnvBD7xBcFviHjfL
✅ Preview: https://semiotic-git-ordinalnetworkframeconversion-nteract.vercel.app
[Deployment for ec02017 failed]
There was only one aspect that I had to muddle through to fix: we want people to easily be able to change the scale types for the numerical scales, as such oScaleType is sort of the odd man out. We really don't want to let people change that but, then again, it might be a way for them to hack what they want into OrdinalFrame. But to get this to work we need to either have some pretty sophisticated typing for those props or just rely on using any
and leave developers a bit out in the cold when using them.
We know that Semiotic users want to replace the default numerical scales with scalePow
and scaleLog
etc and also polylinear scales (scaleLinear
with more than two steps). The current setup allows them to send either scalePow
for example or scalePow(2)
and still get results. To deal with this, though, we have to have some way of knowing if the scale is instantiated or not. My typescript fu isn't strong enough for that, so you can see I cast them as any
which we can go back to and clean up, but I wanted to capture the reasoning here.
That said I could only get serve-examples to work, but it seems like the OrdinalFrame functionality there is in order, so I'm going to approve and merge the PR and when I can test it more robustly, if I see any issues, I'll tackle those.
Converting some more stuff to functions. In the same way as
XYFrame
, Ordinal and Network frames were pretty easy to move to function components, by using previously implementeduseDerivedStateFromProps
anduseLegacyUnmountCallback
. I used the old docs and examples to test the changes, at least to ensure I'm not breaking anything. Couple of small details regarding this PR:NetworkFrame
there were some unused props (likeonNodeOut
) that I removed from both the component and related typingsOrdinalFrame
there were possibly incorrect default props values foroScaleType: scaleBand
andrScaleType: scaleLinear
which TS pointed to. So I changed the values tooScaleType: scaleBand()
andrScaleType: scaleLinear()
(note the parentheses) and the type error's gone.After this PR is merged, only two components are left to be converted:
InteractionLayer
andVisualizationLayer
. Those are slightly harder to work with. I think I'll be able to finish my work on #601 first and then continue with the layers conversion.