1. Home
  2. Docs
  3. Graph Chart
  4. Stacked Graph Manager

Stacked Graph Manager

In version 1.13.0 we have added two scripts StackGraphManager.cs and StackedGraphExample.cs. They can be found in Tutorials/StackedGraph along with an example scene showing how to use them.

StackGraphManager.cs allows you to create stacked graphs and stream data to them. Also allowing to show /hide categories (changing their stacking).

You can use StackGraphManager by doing the following:

  1. Set up your categories (either by script or by inspector)
  2. Call the InitialData method , if there is some initial data to add. You can also call it with an empty array if you wish to clear the data
  3. Call AddPointRealtime to add new stacked points to the stacked chart
  4. Call SetCategoryEnabled/ToggleCategoryEnabled to show/hide categories
//setting up initial data      
  for(int i=0; i< yArr.GetLength(0); i++)
            for(int j=0; j<yArr.GetLength(1); j++)
            {
                yArr[i,j] = Random.value * 3;
            }
        manager.InitialData(xArr, yArr);
//adding realtime point
            for (int i = 0; i < newPointYArr.Length; i++)
                newPointYArr[i] = Random.value * 3;
         manager.AddPointRealtime(x, newPointYArr, 1f);
//show/hide category
         manager.ToggleCategoryEnabled(categoryName);



\manager.SetCategoryEnabled(“Player 1”, isEnabled);