[bug] Updating chart js 4.4.1 introduced some plugin errors with a donut chart.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 32/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- chart.js, react, typescript
Direzione di ricerca
L’issue non indica alcun file o test del repository; inizia riproducendo l’esempio Doughnut mostrato con chart.js 4.4.1, chartjs-plugin-annotation 3.0.1 e react-chartjs-2 5.2.0, quindi confrontalo con chart.js 4.4.0. Esamina le opzioni di annotation e i typings del plugin ChartAnnotation; il lavoro è completato quando l’esempio supera il controllo dei tipi e viene renderizzato senza gli errori segnalati con 4.4.1.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I am not sure if this is an issue with this plugin or https://github.com/reactchartjs/react-chartjs-2. Or a combination of both. But the 4.4.1 update to chart js broke me. Rolling back to 4.4.0 makes everything happy again. Looks like some types are missing. Any help would be appreciated.
Package versions
"chart.js": "^4.4.1",
"chartjs-plugin-annotation": "^3.0.1",
"react-chartjs-2": "^5.2.0",
Example Code:
const options = {
scales: {
x: {
grid: {
display: false,
},
display: false,
},
y: {
grid: {
display: false,
},
display: false,
},
},
plugins: {
legend: {
position: "bottom" as const,
align: "start" as const,
maxWidth: 1,
display: true,
labels: {
usePointStyle: false,
padding: 10,
},
textDirection: "ltr",
},
annotation: {
annotations: {
label1: {
type: "label" as const,
xValue: 2,
yValue: 0.5,
content: "",
color: widget.darkerblue,
font: {
size: 30,
weight: "bold",
family: "Lato, Arial, sans-serif",
},
},
},
},
},
responsive: true,
maintainAspectRatio: false,
};
export default function Donut() {
return <Doughnut data={data} options={options} />;
}
Error Text 1:
TS2322: Type 'PreventiveMaintenanceBarChartOptions' is not assignable to type '_DeepPartialObject<CoreChartOptions<"doughnut"> & ElementChartOptions<"doughnut"> & PluginChartOptions<"doughnut"> & DatasetChartOptions<"doughnut"> & ScaleChartOptions<...> & DoughnutControllerChartOptions>'.
The types of 'plugins.annotation.annotations' are incompatible between these types.
Type '{ [key: string]: { type: "label"; xValue: number; yValue: number; color: string; content: string; font: { size: number; weight: string; }; }; }' is not assignable to type '_DeepPartialArray<AnnotationOptions<keyof AnnotationTypeRegistry>> | _DeepPartialObject<Record<string, AnnotationOptions<keyof AnnotationTypeRegistry>>> | undefined'.
Type '{ [key: string]: { type: "label"; xValue: number; yValue: number; color: string; content: string; font: { size: number; weight: string; }; }; }' is missing the following properties from type '(_DeepPartialObject<{ type: "line"; } & LineAnnotationOptions> | _DeepPartialObject<{ type: "label"; } & LabelAnnotationOptions> | _DeepPartialObject<...> | _DeepPartialObject<...> | _DeepPartialObject<...> | _DeepPartialObject<...>)[]': length, pop, push, concat, and 35 more.
219 | ref={chartRef}
220 | data={doughnutChartData}
> 221 | options={doughnutChartOptions}
Error Text 2:
TS2322: Type 'Plugin<keyof ChartTypeRegistry, AnyObject>' is not assignable to type 'Plugin<"doughnut", AnyObject>'.
Types of property 'install' are incompatible.
Type '((chart: Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>, args: EmptyObject, options: AnyObject) => void) | undefined' is not assignable to type '((chart: Chart<"doughnut", number[], unknown>, args: EmptyObject, options: AnyObject) => void) | undefined'.
Type '(chart: Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>, args: EmptyObject, options: AnyObject) => void' is not assignable to type '(chart: Chart<"doughnut", number[], unknown>, args: EmptyObject, options: AnyObject) => void'.
Types of parameters 'chart' and 'chart' are incompatible.
Type 'Chart<"doughnut", number[], unknown>' is not assignable to type 'Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>'.
Types of property 'config' are incompatible.
Type 'ChartConfiguration<"doughnut", number[], unknown> | ChartConfigurationCustomTypesPerDataset<"doughnut", number[], unknown>' is not assignable to type 'ChartConfiguration<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown> | ChartConfigurationCustomTypesPerDataset<...>'.
Type 'ChartConfiguration<"doughnut", number[], unknown>' is not assignable to type 'ChartConfiguration<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown> | ChartConfigurationCustomTypesPerDataset<...>'.
Type 'ChartConfiguration<"doughnut", number[], unknown>' is not assignable to type 'ChartConfiguration<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint | null)[], unknown>'.
Types of property 'options' are incompatible.
Type '_DeepPartialObject<CoreChartOptions<"doughnut"> & ElementChartOptions<"doughnut"> & PluginChartOptions<"doughnut"> & DatasetChartOptions<"doughnut"> & ScaleChartOptions<...> & DoughnutControllerChartOptions> | undefined' is not assignable to type '_DeepPartialObject<CoreChartOptions<keyof ChartTypeRegistry> & ElementChartOptions<keyof ChartTypeRegistry> & PluginChartOptions<...> & DatasetChartOptions<...> & ScaleChartOptions<...>> | undefined'.
Type '_DeepPartialObject<CoreChartOptions<"doughnut"> & ElementChartOptions<"doughnut"> & PluginChartOptions<"doughnut"> & DatasetChartOptions<"doughnut"> & ScaleChartOptions<...> & DoughnutControllerChartOptions>' is not assignable to type '_DeepPartialObject<CoreChartOptions<keyof ChartTypeRegistry> & ElementChartOptions<keyof ChartTypeRegistry> & PluginChartOptions<...> & DatasetChartOptions<...> & ScaleChartOptions<...>>'.
Types of property 'animation' are incompatible.
Type 'false | _DeepPartialObject<false & DoughnutAnimationOptions> | _DeepPartialObject<AnimationSpec<"doughnut"> & { onProgress?: ((this: Chart<...>, event: AnimationEvent) => void) | undefined; onComplete?: ((this: Chart<...>, event: AnimationEvent) => void) | undefined; } & false> | _DeepPartialObject<...> | undefined' is not assignable to type 'false | _DeepPartialObject<AnimationSpec<keyof ChartTypeRegistry> & { onProgress?: ((this: Chart<keyof ChartTypeRegistry, (number | ... 3 more ... | null)[], unknown>, event: AnimationEvent) => void) | undefined; onComplete?: ((this: Chart<...>, event: AnimationEvent) => void) | undefined; }> | undefined'.
Type '_DeepPartialObject<false & DoughnutAnimationOptions>' is not assignable to type 'false | _DeepPartialObject<AnimationSpec<keyof ChartTypeRegistry> & { onProgress?: ((this: Chart<keyof ChartTypeRegistry, (number | ... 3 more ... | null)[], unknown>, event: AnimationEvent) => void) | undefined; onComplete?: ((this: Chart<...>, event: AnimationEvent) => void) | undefined; }> | undefined'.
221 | data={doughnutChartData}
222 | options={doughnutChartOptions}
> 223 | plugins={[ChartAnnotation]}
| ^^^^^^^^^^^^^^^
224 | />
225 | <Box height={"5px"} />
226 | <Typography
- Lingua principale
- JavaScript
- Stelle
- 625
- Fork
- 377
- Merge medio
- 1g 9h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di chartjs/chartjs-plugin-annotation
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
TypeScript type issuesForse già presa @joshkel l’ha presa 456 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
Tutte le issue di chartjs/chartjs-plugin-annotation
Issue simili
-
bug confirmed issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
open-webui/open-webui#33196 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
`printf "%o"` prints decimalAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
fable-compiler/Fable#5157 ·
I maintainer di solito rispondono entro 1 giorno
-
New tool: PaperBananaForse già presa @github-actions l’ha presa oggi. Apertasubmission triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
kausalflow/tools#243 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area: apple-music area: build-release bug effort: small priority: high
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ChristianTabor/Argon#32 ·
I maintainer di solito rispondono entro 1 giorno
-
0️⃣ phase/new
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno