Skip to content
GRAPHIC WALKER
APIリファレンス
GraphicRenderer

GraphicRenderer

GraphicRendererは、Graphic Walkerの仕様から事前設定されたチャートをレンダリングします。完全な編集インターフェースなしでチャートを表示し、ユーザーはチャートの閲覧とインタラクションはできますが、フィールドエンコーディングの変更はできません。

import { GraphicRenderer } from '@kanaries/graphic-walker';

使い分け

コンポーネント使用する場面
GraphicWalker完全なドラッグ&ドロップ探索インターフェースが必要な場合
GraphicRendererツールバーコントロールを表示した状態で保存済みチャートを表示したい場合
PureRendererUIクロムなしの最小限の読み取り専用チャートが必要な場合

プロパティ

GraphicRendererGraphicWalkerと同じすべてのプロパティに加え、以下を受け付けます:

プロパティデフォルト説明
containerClassNamestringundefinedチャートコンテナのCSSクラス。
containerStyleReact.CSSPropertiesundefinedチャートコンテナのインラインスタイル。
overrideSize{ mode: 'auto' | 'fixed' | 'full'; width: number; height: number }undefined仕様からのチャートサイズをオーバーライド。

GraphicWalkerのすべてのデータ、外観、i18n、refプロパティもここで適用されます。

使用例

import { GraphicRenderer } from '@kanaries/graphic-walker';
import type { IChart } from '@kanaries/graphic-walker';
 
const savedCharts: IChart[] = [
  {
    visId: 'chart-1',
    name: 'Monthly Revenue',
    encodings: {
      dimensions: [],
      measures: [],
      rows: [{ fid: 'revenue', name: 'Revenue', analyticType: 'measure', semanticType: 'quantitative' }],
      columns: [{ fid: 'month', name: 'Month', analyticType: 'dimension', semanticType: 'temporal' }],
      color: [],
      opacity: [],
      size: [],
      shape: [],
      theta: [],
      radius: [],
      longitude: [],
      latitude: [],
      geoId: [],
      details: [],
      filters: [],
      text: [],
    },
    config: {
      defaultAggregated: true,
      geoms: ['line'],
      coordSystem: 'generic',
      limit: -1,
    },
    layout: {
      showTableSummary: false,
      stack: 'none',
      showActions: false,
      interactiveScale: true,
      zeroScale: true,
      size: { mode: 'auto', width: 800, height: 400 },
      format: {},
      resolve: {},
    },
  },
];
 
function Dashboard() {
  return (
    <GraphicRenderer
      data={data}
      fields={fields}
      chart={savedCharts}
      appearance="media"
    />
  );
}

固定サイズ

<GraphicRenderer
  data={data}
  fields={fields}
  chart={savedCharts}
  overrideSize={{ mode: 'fixed', width: 600, height: 400 }}
/>