-
Notifications
You must be signed in to change notification settings - Fork 125
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
Fixing color to a segment based on value #111
Comments
We tried with another method i.e., Please help :( |
@Abhilash-Koliwad I think you just need to type your d3 color scale appropriately. Something like: const valColorScale: (domain: string) => string = d3.scaleOrdinal()... |
@vasturiano Thankyou for your response.. But we have the same issue when we try the above fix,
Error: TS2322: Type 'ScaleOrdinal<string, unknown, never>' is not assignable to type '(domain: string) => string'. Type 'unknown' is not assignable to type 'string'. |
@Abhilash-Koliwad I've created a TypeScript example here: https://codesandbox.io/s/timelines-ts-cw8m7x?file=/src/index.ts. Can you confirm it works? |
@vasturiano Nope, it doesn't :( We are still getting the same error even when we copied your typescript code, we are also using the same version of libraries as you've done. |
Since it's working in that example, but not in your app, could you create a simple example on codesandbox.io that reproduces the issue? |
@vasturiano I can confirm I'm experiencing the same typing issues, however if I add a "@ts-expect-error" everything works correctly on the chart.
I'm using the following versions: Side note: thanks for your work on this library, Vasco! Great library to use! |
Hi @vasturiano ,
We also wanted to fix the color of the Segment by Value and did the following:
However, there is a compilation error at the above line that says ,
TS2345: Argument of type 'ScaleOrdinal<string, unknown, never>' is not assignable to parameter of type 'Scale<Val, string>'. Types of parameters 'x' and 'input' are incompatible. Type 'Val' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'.
Will you please advise us here..??
Thanks in Advance,
Abhilash
The text was updated successfully, but these errors were encountered: