Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug: IndexSizeError: negative radius passed to canvas.arc when drawing box/label with non-positive size

オープン 初心者向け
#986 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
chart.js, javascript

調査の方向性

アノテーションの描画パスと、スタックに記載されている addRoundedRectPath から始め、ボックスまたはラベルの幅と高さがどのように border-radius の clamp まで渡されるかを追跡します。0 以下の寸法が負の半径を CanvasRenderingContext2D.arc に渡せないようにするか、提案されているようにスキップされるようにします。完了の条件は、折りたたまれたチャートのケースで IndexSizeError が発生しなくなり、有効な角丸ボックスは引き続き描画されることです。

索引モデルが issue の本文から書いたものです。

説明

When an annotation box (or label background) is drawn with a non-positive width/height — e.g. chart area briefly collapsed during layout/resize — the plugin clamps borderRadius with:

clamp(corners, 0, Math.min(w, h) / 2)

If w or h is negative, that max is negative, so even borderRadius: 0 becomes negative. Chart.js then calls ctx.arc(..., radius, ...) and the browser throws:

IndexSizeError: Failed to execute 'arc' on 'CanvasRenderingContext2D': The radius provided (…) is negative.

Where
Plugin: chartjs-plugin-annotation v3.0.1
Stack: annotation draw → addRoundedRectPath → CanvasRenderingContext2D.arc

Triggered in our app during chart expand/collapse / layout thrash (plot area briefly invalid)

Suggestion: Clamp radius with a non-negative max, e.g. Math.max(0, Math.min(w, h) / 2), or skip drawing when w <= 0 or h <= 0.

主要言語
JavaScript
スター
625
フォーク
377
平均マージ
1日 9時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

chartjs/chartjs-plugin-annotation のほかの issue

chartjs/chartjs-plugin-annotation の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。