Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Charts and Graphs for unity3d [Released]

Discussion in 'Assets and Asset Store' started by BitsplashIO, Jan 11, 2017.

  1. MatLoz

    MatLoz

    Joined:
    Dec 17, 2014
    Posts:
    25
    I'm also interesting in your answer to @Colin_MacLeod about clipping. Can you share the way to avoid it ?
     
  2. Reddevildragg

    Reddevildragg

    Joined:
    May 19, 2014
    Posts:
    45
    Hi
    Just a quick question, is there an easy way to enforce the y axis to represent only whole number? grabbing an image just of the asset store for example.
    upload_2020-5-26_15-30-55.png
    would be having this as 8/5/3/0 or something similar?

    Thanks for any help
     
  3. Ajay_11

    Ajay_11

    Joined:
    May 16, 2020
    Posts:
    1
    I am also facing the same issue. My Vuforia AR Camera Not able to render the text (Group, Category labels). it only showing 3D Bar chart. Please let me know how to fix this. below i attached the screenshot of output.
     

    Attached Files:

  4. SANDWYRM

    SANDWYRM

    Joined:
    Jun 13, 2020
    Posts:
    1
    Downloaded and imported this into my current project just now and was immediately greeted with an error regarding file:
    Assets/Chart And Graph/Resources/Chart And Graph/TextContorller/TextControllerCanvas.prefab

    Error:
    Code (CSharp):
    1. ArgumentException: Could not load Prefab contents at path Assets/Chart And Graph/Resources/Chart And Graph/TextContorller/TextControllerCanvas.prefab. Prefabs should have exactly 1 root GameObject, 0 was found.
    2. UnityEditor.PrefabUtility.LoadPrefabContents (System.String assetPath) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Prefabs/PrefabUtility.cs:1822)
    3. PrefabOverrideChart.CleanPrefab (System.String path) (at Assets/Chart And Graph/Editor/PrefabOverrideChart.cs:52)
    4. PrefabOverrideChart+<>c__DisplayClass0_0.<OnPostprocessAllAssets>b__0 () (at Assets/Chart And Graph/Editor/PrefabOverrideChart.cs:21)
    5. UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:322)
    This is not currently a blocker in my experience as of yet, so just wanted to make sure it got reported.
     
  5. carlo_unity237

    carlo_unity237

    Joined:
    Sep 29, 2018
    Posts:
    2
    Looks like the support/documentation web page is currently down.
     
  6. Gabriel_SG

    Gabriel_SG

    Joined:
    Apr 7, 2017
    Posts:
    198
    Yeah I tried to look at some tutorials and it seems like the webpage account is suspended.
     
  7. capgunmatt

    capgunmatt

    Joined:
    Feb 29, 2020
    Posts:
    6
    I'm setting some Y Axis labels manually like so:

    // Add Y Axis Labels for Range data
    foreach (var range in RangesList)
    {
    string RangeYValueString = range.MinHeight == Double.PositiveInfinity ? "100 %" : range.MinHeight.ToString() + "%";
    Graph.VerticalValueToStringMap[range.MinHeight] = RangeYValueString;
    }

    But it does not work.

    range.MinHeight is a double. The string is built correctly, e.g "56.6%"

    This loop is withing a larger method UpdateGraphData(), which is called like so:
    Graph.DataSource.StartBatch();
    UpdateGraphData();
    Graph.DataSource.EndBatch();

    Does anyone know why this is failing for me? Is it to do with the timing of when I called line `Graph.VerticalValueToStringMap[range.MinHeight] = RangeYValueString;`?

    The graph I have updates every second, calling UpdateGraphData() each time.

    Thanks for any help in advance.
     
  8. GilbertLau

    GilbertLau

    Joined:
    Dec 3, 2017
    Posts:
    26
    Is it possible to have two categories, one bound to left y axis and the second category bound to right y axis?
     
  9. rossw3_unity

    rossw3_unity

    Joined:
    Aug 17, 2020
    Posts:
    1
    Hi all hope this does not fall on silent ears but I've been having trouble "Converting between chart space and world space". I am currently working on a bar chart and i'm trying to get the top position, or really any position from the bar. I have tried just about every method and done numerous checks on the names of my categories and Groups. But have failed to get GetBarTrackPosition(), GetBarBottomPosition(), or PointToWorldSpace() to work in any capacity. Here is the code I have written
    Code (CSharp):
    1. public void Run()
    2.     {
    3.         bar.DataSource.StartBatch();
    4.         bar.DataSource.ClearValues();
    5.  
    6.         int[] barValues;
    7.         barValues = new int[10];
    8.  
    9.         var barChart = bar.GetComponent<BarChart>();
    10.  
    11.         for (int i = 0; i < barValues.Length; i++)
    12.         {
    13.             barValues[i] = UnityEngine.Random.Range(1, 30);
    14.  
    15.             string categoryName = (2011 + i).ToString();
    16.             barChart.DataSource.SetValue(categoryName, "Values", barValues[i]);
    17.  
    18.             float animationTime = 1.0f; // one second;
    19.             barChart.DataSource.SlideValue(categoryName, "Values", barValues[i], animationTime);
    20.         }
    21.  
    22.         bar.DataSource.EndBatch();
    23.  
    24.         meanCalculate(barValues);
    25.     }
    26.     public void meanCalculate(int[] values)
    27.     {
    28.         float mean = 0;
    29.         int sum = 0;
    30.  
    31.         for (int x = 0; x < values.Length; x++)
    32.         //sums up all the values
    33.         {
    34.             Debug.Log("value " + x.ToString() + ": " + values[x]);
    35.             sum += values[x];
    36.         }
    37.  
    38.         mean = sum / values.Length;
    39.         Debug.Log("mean: " + mean);
    40.         //calculates the mean
    41.  
    42.         var nearest = values.Aggregate((current, next) => Math.Abs((long)current - mean) < Math.Abs((long)next - mean) ? current : next);
    43.         Debug.Log("nearest: " + nearest);
    44.         int index = Array.IndexOf(values, nearest);
    45.         Debug.Log("Index: " + index);
    46.         string indexCategory = (2011+index).ToString();
    47.         Debug.Log("Index Category: " + indexCategory + "'");
    48.         //finds the closest value in the array to the mean at that index
    49.        
    50.         Vector3 bottomPosition;
    51.  
    52.         Debug.Log(bar.DataSource.GetCategoryName(index));
    53.         Debug.Log(bar.DataSource.GetGroupName(0));
    54.  
    55.         if (bar.GetBarBottomPosition(indexCategory, "Values", out bottomPosition))
    56.         {
    57.             meanPos = bottomPosition;
    58.             meanFullPos = bottomPosition;
    59.  
    60.             Debug.Log("Top Position: " + bottomPosition);
    61.             //topPosition now contains the top position of the bar
    62.         }
    63.         else
    64.         {
    65.             Debug.Log("FAILED, category at index:" + bar.DataSource.GetCategoryName(index) + " ");
    66.         }
    67.  
    68.     }
    Any help on this would be greatly appreciated because I have spent hours and hours trying to get this to work lol. Also provided is my graph settings in images
     

    Attached Files:

  10. CheilGermany

    CheilGermany

    Joined:
    Jul 15, 2020
    Posts:
    1
    Hi and thanks for the asset. Got it working really fast in my project.

    One thing bothers me though. Can you assign a lines color only with a material? So if I want to display 37 lines in a diagram, do I need to prepare 37 materials or is there a way to automatically have randomly different line colors?
     
  11. bpodell

    bpodell

    Joined:
    Nov 11, 2017
    Posts:
    3
    Thank you for creating a great chart plugin!

    Do you know how the values of the item labels can be changed? Some of the values overlap, so I would like to change, for example, 158302 to 158k. Being able to access these to format the values with commas (i.e. Change 158302 to 158,302) would also be helpful.

    Code (CSharp):
    1. //DayChart.GetComponent<ItemLabels>().TextFormat.Suffix = "k";
    2. DayChart.GetComponent<ItemLabels>().Text[i] = Math.Round(ItemLabelValue / 1000, 0).ToString() + "k";

    Change Item Labels.png
     
  12. Feartheway

    Feartheway

    Joined:
    Dec 12, 2017
    Posts:
    87
    does this asset support import / export the data into a csv? i want to create something like this shown in the following video that will export into a formatted text file.

    first questions:
    1) how to change the vertical axis to -100 to 100
    2) how to change horizontal axis 0 to 100
    3) how to click and drag data points in the chart and then have this data change saved?

    the chart is show at 45 seconds in.
     
    Last edited: Aug 26, 2020
  13. GilbertLau

    GilbertLau

    Joined:
    Dec 3, 2017
    Posts:
    26
    I got an issue when running on android. The same code runs on Windows without issue. But then I run it on Andriod, the axes are misaligned. Is there any way to adjust it? Please see the screenshot attached. The Y axis shifted right and up Capture.JPG to the middle of the graph and x axis moved to start from the middle as well
     
  14. carlo_unity237

    carlo_unity237

    Joined:
    Sep 29, 2018
    Posts:
    2
    Hello, I'm using basic graph chart, like from the examples and I'm having trouble with adjusting the "point size" setting under Data categories. The setting does not seem to do anything as is, so I took a look at the code and it seems ProcesssPoint(... on the line 486 in CanvasLines.cs is overwriting the point size setting(ver. 1.91). Or am I missing something here?
     
    Last edited: Sep 7, 2020
  15. Juanchi_22

    Juanchi_22

    Joined:
    Oct 12, 2020
    Posts:
    2
    Hello, I hope that you are all fine!

    I've got a problem: I want to disable a category from script with the method DataSource.SetCategoryEnabled() that is explained in the documentation... But I receive this error that says "Error CS1061 'GraphData does not contain a definition for SetCateogryEnabled()'". I already create a variable that reference to the GraphChart that I am using.

    Is the method no longer supported or am I doing something wrong?

    Sorry for my english. Any help is welcome! Thanks
     
  16. BitsplashIO

    BitsplashIO

    Joined:
    Dec 9, 2016
    Posts:
    145
    make sure to write the correct method name, the one you wrote is not correct : SetCateogryEnabled
     
    Juanchi_22 likes this.
  17. Juanchi_22

    Juanchi_22

    Joined:
    Oct 12, 2020
    Posts:
    2
    Hi, thank you so much for your reply!

    I misspelled that, but in my script I have the method well written and the error remains the same. I'll keep looking and if I find something I'll leave it here.

    One last question: is there a way to shade an area between 2 lines of the Graph Chart?
     
unityunity