Search Unity

[Released] Graph Maker - UGUI - NGUI - DFGUI (line graphs, bar graphs, pie graphs, etc)

Discussion in 'Assets and Asset Store' started by rorakin3, Sep 26, 2013.

  1. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Yeah, you can do this using the Groups list on the graph, you can see WMG_X_Tutorial_1.cs for an example. Create a List<string> of possible x-axis values for your graph and assign it to the graph's groups. For your series pointValues, set the X value to correspond to the index of the groups list, starting from 1. So if the first group is "W1 1984", the X in the Vector2 would be 1. Next make sure useGroups is enabled on the graph, and if you want the x-axis labels to display the groups, set the xAxis label type to groups.

    Lastly, if you want to also display the group name when you hover over the point and not just x-axis, you can override the tooltip to do so. In your override function you take x-value of the point you hovered over and use that to pull the group from the groups list on the graph. To see example on how to override tooltip with your custom one see the "customTooltipLabeler" function in WMG_X_Plot_Overtime.cs
     
  2. MihaMarn

    MihaMarn

    Joined:
    Nov 6, 2017
    Posts:
    15
    Hello;

    I need an graph asset capable of drawing large ammounts of data in a short period of time. It needs to be quick. The graph needs to :

    1. Be capable of drawing multiple lines(up to five) with up to 10.000 points (in under one second on a decent machine(i7 4th gen U series w Nvidea 860) or in up to two seconds on a tablet(asus zen pad 10). Lets say 50.000 points all together. But I am a bit flexible on that number.)

    2. It has to be interactible. There has to be a way to click on graph lines and draw vertical lines on clicked points. (I can put other vertical line- GameObjects on the coordinates that I get from clicking a graph line, but I have to have world space coordinates to do that)

    3.Auto rescaler that rescales the axis so the whole graph can fit the screen would be nice, but is not a must. I can handle this myselve.

    4. It would be nice to have an option of storeing all drawn points into an array and correcting their position post festum , without redrawing a complete graph. Just redrawing the points whoose coordinates are corrected.


    Thanks;
     
  3. TareqProjects

    TareqProjects

    Joined:
    Jun 27, 2016
    Posts:
    55
    In the plot overtime example, are you using an event to get a panel to display when you hover the mouse of the a node? Looking through the code, I can see that it changes the format of what's being displayed but I'm not sure what function is being called that handles displaying the small panel

    edit: just to add, the Tooltip option is enabled in my WMG_Axis_Graph/Tooltip but I'm still not getting tooltips to display when I hover over a node

    Edit again: I fixed the problem (as always, it was a silly error on my part). Make sure that the parent gameobject/prefab has a Graphic Raycaster script on it and save yourself the headache
     
    Last edited: Sep 24, 2018
  4. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hi there,

    1. I don't think 50,000 interactive points in under a second will be doable, you can always offload the initial creation time during a loading screen, however you will still probably have poor FPS.
    2. This shouldn't be much of a problem.
    3. There are settings to make the axes fit to the data, additionally fitting the graph to a screen or some other object is easy within the Unity UI system.
    4. Graph Maker handles this by only doing stuff when things change. For example initially you set a list of 50,000 points, it will create 50,000 objects. Then if you delete / add 10 points, it will destroy / create 10 objects, or if you change 10 of the datapoints it will move the corresponding 10 objects.
    There are more advanced rendering techniques, to handle #1, which I have implemented for line drawing as an option if you want to use. It basically involves the GPU creating a texture through a compute shader. The downside is your target platform must have a bunch of requirements in order to support compute shaders, more info here https://docs.unity3d.com/Manual/ComputeShaders.html

    Similar to how I implemented line rendering with compute shader, you could implement point rendering with compute shader as well as a custom point interaction system that involves casting a ray from the camera to the mouse position, determining it's relative position in the graph, then computing the distances from that position to all point positions, finding the minimum distance to find the closest point, then once you have the point closest to the mouse you can use a radius to see if your mouse is hovering over it, then you can do what you want, for example create a real point object that does a hover animation and a tooltip.
     
  5. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Cool glad you fixed it, yeah just ensure there is a Graphics Raycaster, or if you are doing interactive Ring / Pie Charts, a WMG_Raycaster (which inherits from Graphics Raycaster). The typical raycaster only works on rectangles, but this one checks the alpha transparency of the pixel of the image hit, allowing more complex shapes.
     
    Last edited: Sep 26, 2018
  6. Nacho84

    Nacho84

    Joined:
    Jun 3, 2010
    Posts:
    8
    Apologies for my late reply, I only got around to look into this issue today. Your suggestion regarding the sample from WMG_X_Plot_Overtime.cs worked great, thank you very much for the advice!
     
  7. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    No problem!
     
  8. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    New Graph Maker version 1.5.9 has been submitted to the store for review (finally!). Here is the change log:
    1.5.9
    - NEW: New high performance line rendering option. Renders all lines in a single texture near instantly via GPU (requires target platform able to use Compute Shaders).
    - NEW: Options to move axes ticks / labels to be positioned on the inside of the axes.
    - NEW: Ring Graph - Option to start label lines from the center of the bands instead of the outside edge.
    - NEW: Easy way to mask out data outside of the graph boundaries - just add a RectMask2D component to the series gameobject.
    - NEW: Several new example scenes - Radar graph, stacked line, and more.
    - FIX: Series data labels displaying 0 for null data points.
    - FIX: Fix an error with Text Mesh Pro usage
    - CHANGE: Plot Overtime Example scene - vertical grid lines now move as the graph animates to the right.
    - CHANGE: Default tooltip labels when using groups now display the group name string.
    - CHANGE: Removed NGUI package, email if needed.

    Let me know if you have any questions!
     
  9. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    35
    Hi,

    I am using graph maker 1.5.8

    Trying to convert to Text Mesh pro.
    I have used the process documented here
    First I do not have a Canvas called "canvas" so your conversion editor script does not work for me. I had to load one of your example scene for your conversion script to run which I think is fine. I could see the changes taking place in the Graphmaker prefabs.

    Now I have the following errors
    Assets/Graph_Maker/Scripts/Graphs/WMG_Bezier_Band_Graph.cs(334,4): error CS0103: The name `refreshTextRectTransformSize' does not exist in the current context
    Assets/Graph_Maker/Scripts/Graphs/WMG_Bezier_Band_Graph.cs(335,4): error CS0103: The name `refreshTextRectTransformSize' does not exist in the current context

    Code (CSharp):
    1.     void UpdateFontSize() {
    2.         for (int i = 0; i < values.Count; i++) {
    3.             changeLabelFontSize(bands[i].percentLabel, fontSize);
    4.             changeLabelFontSize(bands[i].label, fontSize);
    5.             refreshTextRectTransformSize(bands[i].percentLabel);
    6.             refreshTextRectTransformSize(bands[i].label);
    7.         }
    8.     }
    If I add TMP_PRESENT in the unity3d player settings I have a total of 12 error, please see image attached for details.

    What am I doing wrong, do you know ?
     

    Attached Files:

  10. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Hi looking for AudioLoundness Sample please
     
  11. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey, in the latest Graph Maker version (and I think the version I sent you via email few months back) you don't need to change the inheritance of WMG_GUI_Functions anymore. All the functions for both TextMeshPro and Unity font system should be in one class (WMG_Text_Functions) and uses the TMP_PRESENT preprocessor macro to determine which sections of code to compile. It should look like this

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using UnityEngine.UI;
    5. #if TMP_PRESENT
    6. using TMPro;
    7. #endif
    8.  
    9. public class WMG_Text_Functions : MonoBehaviour {
    10.  
    11.     public enum WMGpivotTypes {Bottom, BottomLeft, BottomRight, Center, Left, Right, Top, TopLeft, TopRight};
    12.  
    13.     #if TMP_PRESENT
    14.     public void changeLabelText(GameObject obj, string aText) {
    15.         TextMeshProUGUI theLabel = obj.GetComponent<TextMeshProUGUI>();
    16.         theLabel.text = aText;
    17.         refreshTextRectTransformSize(obj); // graph maker code should always change text after fontSize / fontStyle / font, so refresh called here only once
    18.     }
    19.    
    20.     public void changeLabelFontSize(GameObject obj, int newFontSize) {
    21.         TextMeshProUGUI theLabel = obj.GetComponent<TextMeshProUGUI>();
    22.         theLabel.fontSize = newFontSize;
    23.     }
    24.  
    25.     public void changeLabelFontStyle(GameObject obj, FontStyle newFontStyle) {
    26.         TextMeshProUGUI theLabel = obj.GetComponent<TextMeshProUGUI>();
    27.         if (newFontStyle == FontStyle.Bold) {
    28.             theLabel.fontStyle = TMPro.FontStyles.Bold;
    29.         }
    30.         else if (newFontStyle == FontStyle.Italic) {
    31.             theLabel.fontStyle = TMPro.FontStyles.Italic;
    32.         }
    33.         else {
    34.             theLabel.fontStyle = TMPro.FontStyles.Normal;
    35.         }
    36.     }
    37.    
    38.     public void changeLabelFont(GameObject obj, TMP_FontAsset newFont) {
    39.         TextMeshProUGUI theLabel = obj.GetComponent<TextMeshProUGUI>();
    40.         theLabel.font = newFont;
    41.     }
    42.  
    43.     public void refreshTextRectTransformSize(GameObject obj) {
    44.         TextMeshProUGUI text = obj.GetComponent<TextMeshProUGUI> ();
    45.         RectTransform textRt = obj.GetComponent<RectTransform>();
    46.         text.ForceMeshUpdate();
    47.         textRt.sizeDelta = new Vector2 (text.preferredWidth, text.preferredHeight);
    48.         text.ForceMeshUpdate();
    49.         textRt.sizeDelta = new Vector2 (text.preferredWidth, text.preferredHeight);
    50.         text.ForceMeshUpdate();
    51.     }
    52.    
    53.     public void changeSpritePivot(GameObject obj, WMGpivotTypes theType) {
    54.         RectTransform theSprite = obj.GetComponent<RectTransform>();
    55.         TextMeshProUGUI theText = obj.GetComponent<TextMeshProUGUI>();
    56.         if (theSprite == null) return;
    57.         if (theType == WMGpivotTypes.Bottom) {
    58.             theSprite.pivot = new Vector2(0.5f, 0f);
    59.             if (theText != null) theText.alignment = TextAlignmentOptions.Bottom;
    60.         }
    61.         else if (theType == WMGpivotTypes.BottomLeft) {
    62.             theSprite.pivot = new Vector2(0f, 0f);
    63.             if (theText != null) theText.alignment = TextAlignmentOptions.BottomLeft;
    64.         }
    65.         else if (theType == WMGpivotTypes.BottomRight) {
    66.             theSprite.pivot = new Vector2(1f, 0f);
    67.             if (theText != null) theText.alignment = TextAlignmentOptions.BottomRight;
    68.         }
    69.         else if (theType == WMGpivotTypes.Center) {
    70.             theSprite.pivot = new Vector2(0.5f, 0.5f);
    71.             if (theText != null) theText.alignment = TextAlignmentOptions.Center;
    72.         }
    73.         else if (theType == WMGpivotTypes.Left) {
    74.             theSprite.pivot = new Vector2(0f, 0.5f);
    75.             if (theText != null) theText.alignment = TextAlignmentOptions.Left;
    76.         }
    77.         else if (theType == WMGpivotTypes.Right) {
    78.             theSprite.pivot = new Vector2(1f, 0.5f);
    79.             if (theText != null) theText.alignment = TextAlignmentOptions.Right;
    80.         }
    81.         else if (theType == WMGpivotTypes.Top) {
    82.             theSprite.pivot = new Vector2(0.5f, 1f);
    83.             if (theText != null) theText.alignment = TextAlignmentOptions.Top;
    84.         }
    85.         else if (theType == WMGpivotTypes.TopLeft) {
    86.             theSprite.pivot = new Vector2(0f, 1f);
    87.             if (theText != null) theText.alignment = TextAlignmentOptions.TopLeft;
    88.         }
    89.         else if (theType == WMGpivotTypes.TopRight) {
    90.             theSprite.pivot = new Vector2(1f, 1f);
    91.             if (theText != null) theText.alignment = TextAlignmentOptions.TopRight;
    92.         }
    93.     }
    94.    
    95.     public void changeLabelColor(GameObject obj, Color newColor) {
    96.         TextMeshProUGUI theLabel = obj.GetComponent<TextMeshProUGUI>();
    97.         theLabel.color = newColor;
    98.     }
    99.  
    100.     #else
    101.  
    102.     public void changeLabelText(GameObject obj, string aText) {
    103.         Text theLabel = obj.GetComponent<Text>();
    104.         theLabel.text = aText;
    105.         refreshTextRectTransformSize (obj); // graph maker code should always change text after fontSize / fontStyle / font, so refresh called here only once
    106.     }
    107.    
    108.     public void changeLabelFontSize(GameObject obj, int newFontSize) {
    109.         Text theLabel = obj.GetComponent<Text>();
    110.         theLabel.fontSize = newFontSize;
    111.     }
    112.  
    113.     public void changeLabelFontStyle(GameObject obj, FontStyle newFontStyle) {
    114.         Text theLabel = obj.GetComponent<Text>();
    115.         theLabel.fontStyle = newFontStyle;
    116.     }
    117.    
    118.     public void changeLabelFont(GameObject obj, Font newFont) {
    119.         Text theLabel = obj.GetComponent<Text>();
    120.         theLabel.font = newFont;
    121.     }
    122.  
    123.     public void refreshTextRectTransformSize(GameObject obj) {
    124.         RectTransform textRt = obj.GetComponent<RectTransform>();
    125.         textRt.sizeDelta = getTextSizePreferred(obj);
    126.     }
    127.  
    128.     //http://answers.unity3d.com/questions/921726/how-to-get-the-size-of-a-unityengineuitext-for-whi.html
    129.     Vector2 getTextSizePreferred (GameObject obj) {
    130.         Text textComp = obj.GetComponent<Text> ();
    131.         return new Vector2 (textComp.cachedTextGeneratorForLayout.GetPreferredWidth (
    132.             textComp.text, textComp.GetGenerationSettings (textComp.GetComponent<RectTransform> ().rect.size)),
    133.                             textComp.cachedTextGeneratorForLayout.GetPreferredHeight (
    134.             textComp.text, textComp.GetGenerationSettings (textComp.GetComponent<RectTransform> ().rect.size)));
    135.     }
    136.  
    137.     public void changeSpritePivot(GameObject obj, WMGpivotTypes theType) {
    138.         RectTransform theSprite = obj.GetComponent<RectTransform>();
    139.         Text theText = obj.GetComponent<Text>();
    140.         if (theSprite == null) return;
    141.         if (theType == WMGpivotTypes.Bottom) {
    142.             theSprite.pivot = new Vector2(0.5f, 0f);
    143.             if (theText != null) theText.alignment = TextAnchor.LowerCenter;
    144.         }
    145.         else if (theType == WMGpivotTypes.BottomLeft) {
    146.             theSprite.pivot = new Vector2(0f, 0f);
    147.             if (theText != null) theText.alignment = TextAnchor.LowerLeft;
    148.         }
    149.         else if (theType == WMGpivotTypes.BottomRight) {
    150.             theSprite.pivot = new Vector2(1f, 0f);
    151.             if (theText != null) theText.alignment = TextAnchor.LowerRight;
    152.         }
    153.         else if (theType == WMGpivotTypes.Center) {
    154.             theSprite.pivot = new Vector2(0.5f, 0.5f);
    155.             if (theText != null) theText.alignment = TextAnchor.MiddleCenter;
    156.         }
    157.         else if (theType == WMGpivotTypes.Left) {
    158.             theSprite.pivot = new Vector2(0f, 0.5f);
    159.             if (theText != null) theText.alignment = TextAnchor.MiddleLeft;
    160.         }
    161.         else if (theType == WMGpivotTypes.Right) {
    162.             theSprite.pivot = new Vector2(1f, 0.5f);
    163.             if (theText != null) theText.alignment = TextAnchor.MiddleRight;
    164.         }
    165.         else if (theType == WMGpivotTypes.Top) {
    166.             theSprite.pivot = new Vector2(0.5f, 1f);
    167.             if (theText != null) theText.alignment = TextAnchor.UpperCenter;
    168.         }
    169.         else if (theType == WMGpivotTypes.TopLeft) {
    170.             theSprite.pivot = new Vector2(0f, 1f);
    171.             if (theText != null) theText.alignment = TextAnchor.UpperLeft;
    172.         }
    173.         else if (theType == WMGpivotTypes.TopRight) {
    174.             theSprite.pivot = new Vector2(1f, 1f);
    175.             if (theText != null) theText.alignment = TextAnchor.UpperRight;
    176.         }
    177.     }
    178.  
    179.     public void changeLabelColor(GameObject obj, Color newColor) {
    180.         Text theLabel = obj.GetComponent<Text>();
    181.         theLabel.color = newColor;
    182.     }
    183.     #endif
    184. }
    185.  
     
  12. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Think you posted in the wrong thread.
     
  13. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Apologies for the delay in 1.5.9 being posted on the asset store. I submitted, but there are some new requirements for publishers and I need to make some updates to my website.
     
  14. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    35

    Thanks for responding. I did what you said and it is now working for most of the examples (X_Dynamic, X_Sample_Pie, etc) you provide in your library but not all of them.
    For example it does not work for X_Plot_overtime.unity and I get the same error for my own project so I guess this is the same issue. I thought it was because the TMP_font was not defined in the prefab, I did that but it did not help.

    Please find attached the screen capture of the error I get, I hope this is going to give you a clue on what I need to do next :)
     

    Attached Files:

  15. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Ah thanks, yeah this is an issue which I have resolved. The UGUI to TMP prefab conversion scripts only looks at prefabs in the Prefabs folder and ignores the examples folder. Luckily, there is only 1 prefab in the example folder that is missed. That is Example/X_Plot_Overtime/Indicator.prefab.
    To fix you can drag the Example/X_Plot_Overtime/Indicator.prefab to an empty scene navigate to the "Text" gameobject under it. Then remove the Text component, then add component - "TextMeshPro Text (UI)". Then click the Indicator prefab and hit "Apply" button in top right of the inspector to save the prefab change.
     
  16. thekingsuren11

    thekingsuren11

    Joined:
    Jun 8, 2018
    Posts:
    1
    Hi. I want to ask about the X_Equation_plotter example scene. It doesn't work for the x^4 equation. And is it possible to do the graph for both x&y equation combined such as x^2+2y-4. I would also love to know whether is it possible to make transformation. If i want to make transfomations, how to get the coordinate values.
     
  17. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey there, x^4 should work but the scale not be what you are expecting because in the example it always goes -10 to 10 on x-axis, but you probably want a small x-axis min and max values to see the curve better. Unfortunately graphing for both x and y in the equation is very complicated and beyond the scope of the example scene. I think the technique is to try many possibilities and to use a spacial data structure such as a quad tree to reduce the amount of possibilities needed to perform.
     
  18. TareqProjects

    TareqProjects

    Joined:
    Jun 27, 2016
    Posts:
    55
    In your WMG_X_Large_LinesOnly scene, is it possible to get the node points to be visible as well? I've tried setting the neverCreatePoints to false but that doesn't change anything. When the graph loads, it sets all the node points to be inactive so there's something else that's disabling the node points from being visible that I can't quite find
     
  19. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    There's also the hidePoints setting which sets them as inactive.
     
    TareqProjects likes this.
  20. TareqProjects

    TareqProjects

    Joined:
    Jun 27, 2016
    Posts:
    55
    Is the website for the API docs down permanently?
     
  21. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    No, shouldn't be down. Looking into it
     
  22. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Should be back up, was an issue with name servers, was using an older server, guess I had to update it manually.
     
  23. CameronGoosen

    CameronGoosen

    Joined:
    Jan 11, 2017
    Posts:
    28
    @rorakin3
    I am having trouble displaying data in a BarChart, its data(series and group) is being created in code and set in code. The graph is being referenced through unity and not instantiated every time.

    Code (CSharp):
    1.         graph.Init();
    2.         //groups
    3.         List<string> groups = new List<string>();
    4.  
    5.         groups.Add("Risk");
    6.         groups.Add("Recur Inv");
    7.         groups.Add("Single Inv");
    8.         groups.Add("Adhocs");
    9.  
    10.         graph.useGroups = true;
    11.         graph.groups.SetList(groups);
    12.         graph.xAxis.LabelType = WMG_Axis.labelTypes.groups;
    13.         graph.xAxis.AxisNumTicks = groups.Count;
    14.  
    15.         //series
    16.         series1 = graph.addSeries();
    17.         series1.seriesName = "Last Year";
    18.         series1.UseXDistBetweenToSpace = true;
    19.         series1.pointValues.SetList(data1);  //List<Vector2> data1 is being set else where
    20.  
    21.         graph.autoUpdateSeriesAxisSpacing = true;
    The data for group and series is still null after this code has run.

    I'm probably missing something super simple, any help is appreciated, thanks.
     
  24. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey thanks for the email, hope you got it resolved.
     
  25. jackp89

    jackp89

    Joined:
    Apr 18, 2019
    Posts:
    1
    @rorakin3 is there any news on the 1.5.9 Version?
     
  26. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    Hopefully soon, if you can let me know your email address, I can email you an attached latest version.
     
  27. Deleted User

    Deleted User

    Guest

    This Work with newer version of unity ( 2018.3.8) ?
    please reply looking forward to buy
     
  28. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,945
    what about 2019.1?
     
  29. CameronGoosen

    CameronGoosen

    Joined:
    Jan 11, 2017
    Posts:
    28
  30. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    @sarfrazzzHOME @jGate99 Yup should work in latest Unity versions. Company I work for is heavily using it in Unity version 2018.4.0f1 currently. Feel free to email me your invoice #, and I can send you latest version which has these changes among some others:

    1.5.9
    - NEW: New high performance line rendering option. Renders all lines in a single texture near instantly via GPU (requires target platform able to use Compute Shaders).
    - NEW: Options to move axes ticks / labels to be positioned on the inside of the axes.
    - NEW: Ring Graph - Option to start label lines from the center of the bands instead of the outside edge.
    - NEW: Easy way to mask out data outside of the graph boundaries - just add a RectMask2D component to the series gameobject.
    - NEW: Several new example scenes - Radar graph, stacked line, and more.
    - FIX: Series data labels displaying 0 for null data points.
    - FIX: Fix an error with Text Mesh Pro usage
    - CHANGE: Plot Overtime Example scene - vertical grid lines now move as the graph animates to the right.
    - CHANGE: Default tooltip labels when using groups now display the group name string.
    - CHANGE: Removed NGUI package, email if needed.
     
  31. tianmowuming

    tianmowuming

    Joined:
    Aug 3, 2015
    Posts:
    9
    • How to change data in real-time? Bar chart and pie chart
      Thanks
     
  32. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Last edited: Oct 13, 2019
  33. carcheng

    carcheng

    Joined:
    May 22, 2019
    Posts:
    2
    Hi there! Just wanted to say that your package has been pretty amazing and a lot of help!
    I'm currently trying to implement a feature so that if you click on the graph, it'll resize to fit the screen. I've been checking out what your document has about clickable events but it doesn't seem like there's anything about a listener for the whole graph (but I may have missed something). Do you have any suggestions of how this should be implemented?
     
  34. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hi there,
    I would suggest to add a Button component to the background of the graph:
    http://stuart-summerfield.com/Graph..._graph.html#aac6ff13be26a1ccffcc506e65d3cb006
    You can then set the Button click event to a function you have that stretches the graph's rect transform. I think this should work. The way we do it (company I work for), is we have a maximize icon button in the top right corner of the graph.
     
    Last edited: Oct 13, 2019
  35. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey guys,
    Note that I've moved my website domain from stew-soft.com to stuart-summerfield.com
    I'm in the process of updating all links, and have submitted a new package with newly updated links for the asset store as well.
     
    manpower13 likes this.
  36. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    35
    Hi,

    I have unity3d version 2018.4.11f1 and just imported graphmaker 1.5.9 none of the examples are working and when I drop the LineGraph prefab into a canvas and run I guess the following errors messages

    Thought that is was because no TMP font where in the axes, did that but does not make a difference.

    NullReferenceException: Object reference not set to an instance of an object
    WMG_Text_Functions.changeLabelFontSize (UnityEngine.GameObject obj, System.Int32 newFontSize) (at Assets/Graph_Maker/Scripts/GUIDependent/WMG_Text_Functions.cs:21)
    WMG_Legend.updateLegend () (at Assets/Graph_Maker/Scripts/WMG_Legend.cs:641)
    WMG_Series.Init (System.Int32 index) (at Assets/Graph_Maker/Scripts/WMG_Series.cs:858)
    WMG_Axis_Graph.Init () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:759)
    WMG_Axis_Graph.Start () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:725)


    This is releated to the following code
    Code (CSharp):
    1.     public void changeLabelFont(GameObject obj, TMP_FontAsset newFont) {
    2.         TextMeshProUGUI theLabel = obj.GetComponent<TextMeshProUGUI>();
    3.         theLabel.font = newFont;
    4.     }
    Any idea on what could be wrong ?

    Thanks
    Fabien
     
    Last edited: Nov 1, 2019
  37. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey, it looks like just need to convert the prefabs to use text mesh pro. Go into any scene with a canvas and run this:
    Assets -> "Graph Maker" -> "UGUI -> TMP Prefabs"
     
  38. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    35
    :) yes that was it, thank you
     
  39. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Is there any text component in Hierarchical Tree chart?
    I checked there is an Image Component only.

    If I want to display text in the tree objects, how can I display text if there is not any text component in the three objects.
     
  40. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    Yeah so you can just create your own node prefab to have whatever you want in it. Try duplicating the square prefab (used by default), and then modifying it to add a text gameobject as a child. Once you're done making your prefab, assign it to the tree (the 'Default Note Prefab' under 'Misc' tab in WMG_Hierarchical_tree script editor settings.
     
    KAYUMIY likes this.
  41. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    Hi,

    I am looking for high-performance graphs, so I just installed Graph Maker and it seems to be promising.

    For now, I have 2 questions:
    - What are the mandatory directories?
    I suppose that 'Scenes' and 'Examples' can safely be removed, but what about the other directories (especially 'DOTween')?

    - How to use TextMeshPro?
    Paragraph 5.6 of the documentation indicates that I must import 'Graph_Maker/TMP/UGUItoTMP.unitypackage', but I cannot find it. In fact, there's no 'TMP' directory.


    Also, the included documentation may be out of date, the links aren't working.
     
  42. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    - DOTween is a third party package and can be safely moved out of the Graph Maker folder. You can also delete the DOTween folder in Graph Maker and get the latest DOTween package from the DOTween asset store page.
    The Scenes and Examples can be safely deleted, all other folders are needed for function.

    - I need to fix the documentation for TextMeshPro, it is out of date. To get TextMeshPro text working with Graph Maker here are the steps:

    (Note steps 1-4 may already be completed, e.g. as part of some other package. A quick way to check is to see if the editor menu "Assets/Graph Maker/UGUI -> TMP Prefabs" from step 6 exists, if you can't see that menu option then you need to do steps 1-4)
    1. Navigate to [Edit -> Project Settings -> Player]
    2. Unfold the "Other Settings" section
    3. Insert "TMP_PRESENT" (without quotes) in the field with the title "Scripting Define Symbols"
    4. Repeat 2. and 3. for each Platform you want to deploy for.
    5. Open any scene with a Canvas in it, for example any of the Graph Maker example scenes
    6. Go to, and run the unity editor menu "Assets/Graph Maker/UGUI -> TMP Prefabs"
    upload_2020-1-6_20-57-48.png

    That should be it! Yeah I still need to update the PDF manual links, hopefully soon :)
     
    Last edited: Jan 7, 2020
  43. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    35
    Got a very weird problem with PieChart colours

    It seems the colours are set correctly but are not displayed correctly in the editor and game view.

    When the game is playing in the editor and I check the inspector, the colours are all white on the screen but when I double click to open the colour picker window I can see the colour I have set in csharp.

    I have included a picture that show the problem.

    Code (CSharp):
    1.        
    2. public void RefreshSeverityPieData()
    3.         {
    4.             SeverityPieChart.sliceValues.Clear();
    5.             SeverityPieChart.sliceLabels.Clear();
    6.             SeverityPieChart.sliceColors.Clear();
    7.  
    8.             for (int i = 0; i < Main.ActiveRoom.List_PieSeveritySliceValue.Count; i++)
    9.             {
    10.                 if (Main.ActiveRoom.List_PieSeveritySliceValue[i] != 0)
    11.                 {
    12.                     SeverityPieChart.sliceValues.Add(Main.ActiveRoom.List_PieSeveritySliceValue[i]);
    13.                     SeverityPieChart.sliceLabels.Add(List_PieSeveritySliceName[i]);
    14.                     SeverityPieChart.sliceColors.Add(List_PieSeveritySliceColors[i]);
    15.                 }
    16.             }
    17.  
    18.             SeverityPieChart.Refresh();
    19.         }
    Did try to add SeverityPieChart.Init(); after the Clear of the list or right before the Refresh but does not seem to make any differences.
    Did a search in the forum but saw nothing that match my problem, any idea on what I might be doing wrong ?
     

    Attached Files:

  44. Fab-London

    Fab-London

    Joined:
    Feb 6, 2013
    Posts:
    35
    Hi any input will be appreciated
    Thanks
     
  45. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hi, that is quite strange. The colors appear fine in the game / app, it is just the editor window displaying them as white? Try calling Init() before anything else, at the very beginning, this basically just ensures that the pie graph's Start() function is run before your code is run. This is useful if your code is in the Start() or Awake() or OnEnable() of your own script, which may get run before the WMG_Pie_Graph Start() function runs.

    Not calling Init() at the very beginning is the only thing I can think of that would cause an issue like this. Other than that, I'm not sure. Let me know what version of Unity and Graph Maker you are using and I will try to reproduce the issue.
     
    Last edited: Feb 2, 2020
  46. JuanJSAR

    JuanJSAR

    Joined:
    Feb 21, 2014
    Posts:
    47
    Hello, I have a question, how could I fill the inside on a "Radar Graph"

    I have this:
    Captura.JPG

    Necessary:
    índice2.jpg

    How could I achieve that ??
    Thank you for your attention.
     
    Last edited: Mar 25, 2020
  47. Liens

    Liens

    Joined:
    Feb 2, 2012
    Posts:
    49
    Hello, how can I change a Y axis to increase ticks logarithmic? Not the labels but the actual axis tick rate, therefore creating a log scale axis.
     
  48. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Hello @rorakin3, I bought this asset hoping that it would still work with the latest version of NGUI, but I had to dig into one of the older versions to find anything related to NGUI. When I tried it, it didn't seem to work with the latest NGUI. Are there any plans to update this asset for use with the latest NGUI? Thanks!
     
  49. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hmm, unfortunately filling the inside of a radar is a bit complicated / something beyond scope. It looks like the other graph packages will cover radar graph better.
     
  50. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    For logarithmic ticks, you can set the underlying data to be e.g. 1,2,3,4,5 and then have a custom label function that overrides the default labels, it would take in the 5 and do 10^5 displaying 10^5 as a string, up to your decision for how to format the string.