Skip to content

Using MockMagic with Chart Guru

Chart Guru includes Mock Magic and provides a Mock Chart Data Source component. Add it to the same GameObject as the chart, choose the data shape that fits the chart, and configure generation or streaming in the Inspector. The component publishes a data frame that the chart maps to its marks, so no export or custom code is required.

Chart Guru's Monthly sign-ups line chart with eight monthly values from Mock Magic, rising to just under 80 in August.
This Chart Graphic uses the eight monthly values its Mock Chart Data Source generated in Edit Mode.

Adding MockChartDataSource

There are two ways to add it:

  1. From the chart Inspector - Use Add Data Source and choose Mock. The source is added to the same GameObject and starts with a shape chosen for the chart.
  2. From the Add Component menu - Select Add Component > Chart Guru > Data Sources > Mock Chart Data Source on the chart GameObject.

Choose Shape to produce series, scatter, candle, matrix, or surface data. Use the Data tab for generation settings and Generate, or the Streaming tab for live updates. Use Start Streaming and Stop Streaming to control the feed. The chart consumes the source on its own GameObject; there is no Target Chart field to assign.

Works in Edit Mode

MockChartDataSource works in both Edit Mode and Play Mode. You can:

  • Click Generate to preview chart data without entering Play Mode
  • Start streaming to see live chart updates in the Scene view
  • Swap patterns and label presets with instant visual feedback

This makes it an excellent rapid prototyping tool - configure your chart's look and feel with realistic data before writing a single line of code.

Under the Hood

Mock Chart Data Source converts Mock Magic values into the columns needed by its selected data shape:

  • Generate builds the initial data frame from the configured shape, labels, range, and pattern.
  • Streaming retains MockSeriesCursor instances so appended and prepended data continue their patterns; Drip uses the same irregular single-point timing as Mock Magic.
  • Labels continue sequentially across emissions, matching the Live Stream workspace.

Alternative Workflow With an Exported File

If you want an exported file to remain the chart source, use Chart Guru's CSV Chart Data Source or JSON Chart Data Source:

  1. Open the MockMagic Generator window (Tools → Mock Magic → Generator)
  2. Generate the required data in the Series workspace
  3. Open Export beside the result and select CSV or JSON
  4. Save the output under the project's Assets folder so Unity imports it as a TextAsset.
  5. Add the matching CSV or JSON source to the chart GameObject, assign the imported TextAsset, and map its label, value, and series columns in the chart Inspector. For multiple series, prefer CSV, which retains SeriesIndex and SeriesName on each row. Single-series JSON works with an empty Root Selector. For multi-series JSON, set Root Selector to $[0].data to import the first series, or flatten the point records and include a series column before importing all series.

This workflow keeps an editable data file separate from the chart. For immediately generated or streaming data, use Mock Chart Data Source instead.