Skip to content

Data Sources

Data sources are components that build marks and apply them to a target chart. They work in Edit Mode and Play Mode where appropriate, and most data source inspectors expose Refresh or Generate actions for quick iteration.

Source

Use it for

MockChartDataSource

Instant generated data for prototypes and demos. Patterns include Random, Linear, Exponential, Logarithmic, Sine, Cosine, TrendingUp, TrendingDown, Seasonal, Stepped, Sparse, RandomWalk, BellCurve, Sawtooth, and GaussianNoise.

ManualChartDataSource

Hand-entered labels, values, series, colors, and reference rules directly in the Inspector.

CsvChartDataSource

CSV, TSV, semicolon-separated files, TextAssets, StreamingAssets, inline text, or absolute paths.

JsonChartDataSource

JSON files or inline JSON, including nested data via root selectors.

GoogleSheetsChartDataSource

A shared Google Sheets URL converted to chart-ready tabular data.

WebChartDataSource

HTTP CSV or JSON endpoints with headers, polling, retry, and backoff.

YahooFinanceChartDataSource

Stock and financial time-series data for line or candlestick charts.

RingBufferChartDataSource

High-throughput live samples, appended efficiently and flushed once per frame.

Mock data source

MockChartDataSource is the recommended starting point. Choose a pattern, label preset, point count, series count, value range, and noise factor. It can generate once or stream continuously with Constant, Random, Burst, or Drip rhythm.

MockChartDataSource mock = gameObject.AddComponent<MockChartDataSource>();
mock.Pattern = SeriesPattern.TrendingUp;
mock.SeriesCount = 3;
mock.PointsPerSeries = 12;
mock.LabelPreset = LabelPreset.MonthsShort;
mock.GenerateOnce();
mock.StartStreaming();

File and web mapping

CSV, JSON, Sheets, Web, and Yahoo sources parse data into rows and columns, then use ChartDataMapping to decide which columns become X values, Y values, labels, series, and OHLC candles.

  • XColumn becomes the X axis. If empty, row index is used.
  • LabelColumn becomes the category or data label when present.
  • YColumns are the plotted numeric values. WideFormat treats each Y column as its own series.
  • SeriesByColumn pivots long-format data into multiple series.
  • OpenColumn, HighColumn, LowColumn, and CloseColumn create candlestick marks.
  • MaxRows limits how many parsed rows are consumed.

Data source mental model

A data source is not just a loader. It answers four questions: where values come from, how raw text or generated samples become rows and columns, how those columns map to chart semantics, and when the chart should refresh. Once that model is clear, CSV, JSON, Sheets, Web, Yahoo, Manual, Mock, and RingBuffer sources all become variations of the same pipeline.

Chart Guru documentation screenshot

Data source overview. Sources acquire or generate values, normalize them into tabular data, map columns to chart semantics, and emit marks for the shared renderer.

Choosing a data source

Choose the source by ownership and refresh behavior. Use Manual when the scene owns the data, Mock when the real backend is not ready, CSV/JSON for files and exports, Sheets for externally edited tabular data, Web for service-backed dashboards, Yahoo Finance for quick OHLC examples, and RingBuffer for high-frequency live samples.

Chart Guru documentation screenshot

Data source chooser. Each source targets a different ownership and refresh pattern while sharing the same mapping and rendering model.

Individual data sources

ManualChartDataSource is best for scene-owned data and Designer handoff. It supports single-series and multi-series values, reference rules, overlay points, overlay rectangles, symbols, colors, gradients, and reusable styling fields.

MockChartDataSource is the recommended starting point for design, demos, and stress tests. It generates patterns with configurable labels, series counts, noise, value ranges, gradients, and streaming rhythms, so a chart can be designed before a production backend exists.

CsvChartDataSource reads separated-value text from a TextAsset, project path, absolute path, StreamingAssets path, or inline string. It can auto-detect the delimiter, header row, and column types, but the inspector can lock those choices down with delimiter, header mode, comment prefix, skip rows, trimming, and file watching options.

JsonChartDataSource is for structured payloads. Use Root Selector when the useful records live inside a larger API response. Nested objects flatten one level with dot notation, which keeps fields such as ohlc.open or metrics.revenue available for normal mapping.

GoogleSheetsChartDataSource converts a published Google Sheets URL into a CSV export URL. Use it when designers or analysts own a sheet outside Unity. The sheet must be published or otherwise reachable by the player/editor, and the gid selects which worksheet tab is read.

WebChartDataSource polls an HTTP or HTTPS endpoint and parses CSV or JSON responses through the same mapping system. It supports request headers, JSON root selection, CSV options, polling intervals, cancellation, edit-mode preview, and exponential backoff on transient failures.

YahooFinanceChartDataSource is a convenience wrapper for the public Yahoo Finance chart endpoint. It fills symbol, range, interval, OHLCV parsing, and candlestick mapping automatically, making it useful for examples and prototypes. For production market dashboards, prefer a paid market-data provider through WebChartDataSource and avoid aggressive polling.

RingBufferChartDataSource is the live-data path for high-frequency runtime samples. Producers push Y or X/Y values into a fixed-capacity buffer; the chart receives a per-frame flush and can use the stable-shape SetValues path instead of rebuilding marks every sample.

Mapping concepts

  • Wide format means each Y column becomes its own series. This matches spreadsheet exports such as Month, Core, Pro, Enterprise.
  • Long format means one Y column is split by a category or series column. This matches rows such as Quarter, Region, Revenue.
  • XColumn controls the axis position. If it is empty, the row index becomes the X value. LabelColumn controls category/data labels when present.
  • DateFormat and DateCulture stabilize time parsing when the source uses a non-invariant date format or a locale-specific month/day order.
  • OpenColumn, HighColumn, LowColumn, and CloseColumn switch the emitted marks to candlesticks when all four are configured.
  • MaxRows is a safety valve for very large sources. It caps rows before marks are produced, which is useful for previews and heavy files.