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
[Bug]: Cannot import labels enum #1255
Comments
Maybe related to vitejs/vite#2579 |
Hi 👋🏻 |
So this is related to #1148 (comment) and metonym/carbon-charts-svelte-examples#1. Full credit to @benmccann for getting to the bottom of this: metonym/carbon-charts-svelte-examples#1 (comment) @leetrout Try the following workaround:
<script lang="ts">
import { BarChartSimple } from "@carbon/charts-svelte";
import type { BarChartOptions, ScaleTypes } from "@carbon/charts/interfaces";
const options: BarChartOptions = {
title: "Simple bar (discrete)",
height: "400px",
axes: {
left: { mapsTo: "value" },
bottom: { mapsTo: "group", scaleType: "labels" as ScaleTypes.LABELS },
},
};
</script>
<BarChartSimple
data={[
{ group: "Qty", value: 65000 },
{ group: "More", value: 29123 },
{ group: "Sold", value: 35213 },
{ group: "Restocking", value: 51213 },
{ group: "Misc", value: 16932 },
]}
{options}
/>
An alternative is to type |
I'm seeing this same issue with @carbon/charts-react.
|
Hi @leetrout, Pls let us know if @metonym's proposed solutions solves this issue for you #1255 (comment) Closing for now, feel free to reopen with additional details 🙂 |
The installation guide in Svelte README isn't mentioning that the enums are stored in Here is the fixed installation one-liner: npm install -D @carbon/charts-svelte @carbon/charts @carbon/styles d3 d3-cloud d3-sankey Here is the old one:
|
Contact Details
No response
What happened?
Typescript error
And if I try to import it I get a different error:
import { ScaleTypes } from "@carbon/charts/interfaces/enums";
Version
"@carbon/charts-svelte": "^0.54.0"
Data & options used
The text was updated successfully, but these errors were encountered: