-
Notifications
You must be signed in to change notification settings - Fork 1
feat: グラフ共通コンポーネントを追加 #217 #255
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
base: dev
Are you sure you want to change the base?
Conversation
…oved visualization on test page
…rt visualization on test page
…guration on test page
…dant prop from filter.
…ies item styling.
…nd update GraphContainer to use children for flexibility
…ponents and update GraphStatusFilter to remove unused prop
… improved readability
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…le breakpoint handling and adjusting layouts in GraphContainer, GraphSizeLegend, and GraphStatusFilter
…roved visual consistency
kur00
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応ありがとうございます!
| // クライアントサイドでのみecharts-for-reactをロード(SSR対策) | ||
| useEffect(() => { | ||
| const loadECharts = async () => { | ||
| const mod = await import("echarts-for-react"); | ||
| setReactECharts(() => mod.default); | ||
| }; | ||
| void loadECharts(); | ||
| }, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
期間選択などの動的なデータローディングの関係でフロントでやっている感じですか?
| /** ラベルテキスト(例: "インプレッション") */ | ||
| label: string; | ||
| /** 最小値 */ | ||
| min: number; | ||
| /** 最大値 */ | ||
| max: number; | ||
| /** 表示するステップ数(デフォルト: 5) */ | ||
| steps?: number; | ||
| /** 値のフォーマット関数 */ | ||
| formatValue?: (value: number) => string; | ||
| /** バブルの最小サイズ(px)(デフォルト: 8) */ | ||
| minBubbleSize?: number; | ||
| /** バブルの最大サイズ(px)(デフォルト: 32) */ | ||
| maxBubbleSize?: number; | ||
| /** バブルの色(デフォルト: "#666") */ | ||
| bubbleColor?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここら辺、コード見たら大体わかるやつはコメント無しでいいっすよ!
デフォルト情報とかも次のコード見たらわかるので!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
逆にstepsとかどういうステップなのかあると良いかもっすね。折れ線以外にも当てはまるやつですよね?色々、考えちゃいそうで
| /** | ||
| * ステータスカラー定数 | ||
| * グラフやフィルターコンポーネントで使用 | ||
| */ | ||
| export const STATUS_COLORS = { | ||
| published: "#42a5f5", | ||
| evaluating: "#ab47bc", | ||
| unpublished: "#ec407a", | ||
| } as const; | ||
|
|
||
| export type StatusColorKey = keyof typeof STATUS_COLORS; | ||
|
|
||
| /** | ||
| * グラフスタイル定数 | ||
| * EChartsはCanvas/SVGベースのためCSS変数が使えないので、ここで定義 | ||
| */ | ||
| export const GRAPH_STYLES = { | ||
| /** テキスト色(軸ラベル、凡例など) */ | ||
| textColor: "#999999", | ||
| /** 軸線の色 */ | ||
| axisColor: "#666666", | ||
| /** グリッド線の色 */ | ||
| gridColor: "#333333", | ||
| /** ボーダー色 */ | ||
| borderColor: "#555555", | ||
| /** ツールチップ背景色 */ | ||
| tooltipBgColor: "rgba(30, 30, 30, 0.9)", | ||
| /** ツールチップボーダー色 */ | ||
| tooltipBorderColor: "#444444", | ||
| } as const; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここら辺、良いっすね!
constantsディレクトリに収めちゃっても良いなとも思いました!
そしたら、コンポーネントとその他で分離ができるかと
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうなんですよね!
実は次の #218 の作業をやってる最中にそれに気が付きましたorz
なので、一旦マージしてからリファクタリングするしかないかなぁと考えております…!
| /** 現在選択中のステータス */ | ||
| value: StatusValue; | ||
| /** ステータス変更時のコールバック */ | ||
| onChange: (value: StatusValue) => void; | ||
| /** カスタムステータス設定 */ | ||
| statuses?: StatusConfig[]; | ||
| /** ラベルテキスト(デフォルト: "ステータス") */ | ||
| label?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここのコメントもそうですね!
概要
グラフ表示で使用する共通コンポーネントを追加しました。
関連イシュー
追加したコンポーネント
GraphContainer- グラフをラップするレイアウトコンテナEChartsGraph- EChartsグラフ描画コンポーネント(SSR対策済み)GraphStatusFilter- ステータスフィルター(全て/公開中/評価中/非公開)GraphSizeLegend- バブルサイズの凡例(インプレッション等)追加したライブラリ
echarts: 6.0.0echarts-for-react: 3.0.2定数
STATUS_COLORS- ステータス別の色定義GRAPH_STYLES- ECharts用のスタイル定数その他
app.cssにグラフボーダー用のCSS変数を追加test.tsx,test2.tsx)を追加実装結果