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
    Alright, got it working!
    CustomUIShaderWithScrollView.png

    Feel free to send me an email for the fix, or just copy and paste the code below into AreaShadingGradient.shader

    Code (csharp):
    1.  
    2.  
    3. // Shader created with Shader Forge v1.13
    4. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
    5. // Note: Manually altering this data may prevent you from opening it in Shader Forge
    6. /*SF_DATA;ver:1.13;sub:START;pass:START;ps:flbk:,lico:1,lgpr:1,nrmq:1,nrsp:0,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,rprd:False,enco:False,rmgx:True,rpth:0,hqsc:True,hqlp:False,tesm:0,bsrc:3,bdst:7,culm:0,dpts:2,wrdp:False,dith:0,ufog:True,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.1280277,fgcg:0.1953466,fgcb:0.2352941,fgca:1,fgde:0.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:1,x:35743,y:33007,varname:node_1,prsc:2|emission-532-RGB,alpha-563-OUT,clip-533-OUT;n:type:ShaderForge.SFN_Tex2d,id:341,x:34314,y:33617,varname:node_7279,prsc:2,ntxv:0,isnm:False|UVIN-515-OUT,TEX-622-TEX;n:type:ShaderForge.SFN_Rotator,id:342,x:33674,y:33816,varname:node_342,prsc:2|UVIN-347-UVOUT,ANG-443-OUT;n:type:ShaderForge.SFN_TexCoord,id:347,x:33469,y:33672,varname:node_347,prsc:2,uv:0;n:type:ShaderForge.SFN_Pi,id:441,x:33043,y:33883,varname:node_441,prsc:2;n:type:ShaderForge.SFN_Divide,id:443,x:33244,y:33914,varname:node_443,prsc:2|A-441-OUT,B-445-OUT;n:type:ShaderForge.SFN_Vector1,id:445,x:33042,y:34036,varname:node_445,prsc:2,v1:-2;n:type:ShaderForge.SFN_Multiply,id:485,x:34186,y:33174,varname:node_485,prsc:2|A-653-UVOUT,B-489-OUT;n:type:ShaderForge.SFN_Append,id:489,x:34003,y:33293,varname:node_489,prsc:2|A-689-OUT,B-501-OUT;n:type:ShaderForge.SFN_Tex2d,id:495,x:34463,y:33174,varname:node_1737,prsc:2,ntxv:0,isnm:False|UVIN-485-OUT,TEX-622-TEX;n:type:ShaderForge.SFN_Vector1,id:501,x:33786,y:33368,varname:node_501,prsc:2,v1:1;n:type:ShaderForge.SFN_Multiply,id:515,x:33970,y:33783,varname:node_515,prsc:2|A-342-UVOUT,B-519-OUT;n:type:ShaderForge.SFN_Vector1,id:517,x:33502,y:34007,varname:node_517,prsc:2,v1:1;n:type:ShaderForge.SFN_Append,id:519,x:33719,y:34007,varname:node_519,prsc:2|A-517-OUT,B-529-OUT;n:type:ShaderForge.SFN_OneMinus,id:527,x:34633,y:33354,varname:node_527,prsc:2|IN-341-RGB;n:type:ShaderForge.SFN_Slider,id:528,x:32865,y:33648,ptovrint:False,ptlb:Slope,ptin:_Slope,varname:node_5461,prsc:2,min:-1,cur:-0.6666959,max:1;n:type:ShaderForge.SFN_Negate,id:529,x:33490,y:34113,varname:node_529,prsc:2|IN-689-OUT;n:type:ShaderForge.SFN_If,id:530,x:34983,y:33267,varname:node_530,prsc:2|A-689-OUT,B-531-OUT,GT-527-OUT,EQ-527-OUT,LT-495-RGB;n:type:ShaderForge.SFN_Vector1,id:531,x:34633,y:33548,varname:node_531,prsc:2,v1:0;n:type:ShaderForge.SFN_Color,id:532,x:35445,y:32781,ptovrint:False,ptlb:Color,ptin:_Color,varname:node_1711,prsc:2,glob:False,c1:0,c2:1,c3:1,c4:1;n:type:ShaderForge.SFN_ComponentMask,id:533,x:35453,y:33269,varname:node_533,prsc:2,cc1:0,cc2:-1,cc3:-1,cc4:-1|IN-547-OUT;n:type:ShaderForge.SFN_OneMinus,id:547,x:35229,y:33269,varname:node_547,prsc:2|IN-530-OUT;n:type:ShaderForge.SFN_Tex2d,id:549,x:34934,y:32715,ptovrint:False,ptlb:Gradient,ptin:_Gradient,varname:node_7294,prsc:2,ntxv:0,isnm:False|UVIN-679-OUT;n:type:ShaderForge.SFN_Vector3,id:558,x:34934,y:32909,varname:node_558,prsc:2,v1:0,v2:0,v3:0;n:type:ShaderForge.SFN_Lerp,id:559,x:35228,y:32998,varname:node_559,prsc:2|A-549-RGB,B-558-OUT,T-617-OUT;n:type:ShaderForge.SFN_ComponentMask,id:563,x:35453,y:33093,varname:node_563,prsc:2,cc1:0,cc2:-1,cc3:-1,cc4:-1|IN-559-OUT;n:type:ShaderForge.SFN_Slider,id:617,x:34777,y:33038,ptovrint:False,ptlb:Transparency,ptin:_Transparency,varname:node_481,prsc:2,min:0,cur:0,max:1;n:type:ShaderForge.SFN_Tex2dAsset,id:622,x:34031,y:33533,ptovrint:False,ptlb:Corners,ptin:_Corners,varname:node_1771,glob:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Rotator,id:653,x:33887,y:33085,varname:node_653,prsc:2|UVIN-655-UVOUT,ANG-441-OUT;n:type:ShaderForge.SFN_TexCoord,id:655,x:33700,y:32920,varname:node_655,prsc:2,uv:0;n:type:ShaderForge.SFN_Multiply,id:679,x:34671,y:32715,varname:node_679,prsc:2|A-653-UVOUT,B-685-OUT;n:type:ShaderForge.SFN_Vector1,id:681,x:34096,y:32790,varname:node_681,prsc:2,v1:1;n:type:ShaderForge.SFN_Append,id:685,x:34463,y:32956,varname:node_685,prsc:2|A-681-OUT,B-686-OUT;n:type:ShaderForge.SFN_Slider,id:686,x:33939,y:32893,ptovrint:False,ptlb:GradientScale,ptin:_GradientScale,varname:node_4483,prsc:2,min:0,cur:1,max:1;n:type:ShaderForge.SFN_ConstantClamp,id:689,x:33244,y:33518,varname:node_689,prsc:2,min:-1,max:1|IN-528-OUT;proporder:528-686-532-617-549-622;pass:END;sub:END;*/
    7.  
    8. Shader "Shader Forge/NewShader" {
    9.     Properties {
    10.         _Slope ("Slope", Range(-1, 1)) = -0.6666959
    11.         _GradientScale ("GradientScale", Range(0, 1)) = 1
    12.         _Color ("Color", Color) = (0,1,1,1)
    13.         _Transparency ("Transparency", Range(0, 1)) = 0
    14.         _Gradient ("Gradient", 2D) = "white" {}
    15.         _Corners ("Corners", 2D) = "white" {}
    16.         [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
    17.         _StencilComp ("Stencil Comparison", Float) = 8
    18.         _Stencil ("Stencil ID", Float) = 0
    19.         _StencilOp ("Stencil Operation", Float) = 0
    20.         _StencilWriteMask ("Stencil Write Mask", Float) = 255
    21.         _StencilReadMask ("Stencil Read Mask", Float) = 255
    22.         _ColorMask ("Color Mask", Float) = 15
    23.     }
    24.     SubShader {
    25.         Tags {
    26.             "IgnoreProjector"="True"
    27.             "Queue"="Transparent"
    28.             "RenderType"="Transparent"
    29.         }
    30.         Stencil
    31.         {
    32.             Ref [_Stencil]
    33.             Comp [_StencilComp]
    34.             Pass [_StencilOp]
    35.             ReadMask [_StencilReadMask]
    36.             WriteMask [_StencilWriteMask]
    37.         }
    38.           ColorMask [_ColorMask]
    39.         Pass {
    40.             Name "FORWARD"
    41.             Tags {
    42.                 "LightMode"="ForwardBase"
    43.             }
    44.             Blend SrcAlpha OneMinusSrcAlpha
    45.             ZWrite Off
    46.          
    47.             CGPROGRAM
    48.             #pragma vertex vert
    49.             #pragma fragment frag
    50.             #define UNITY_PASS_FORWARDBASE
    51.             #include "UnityCG.cginc"
    52.             #pragma multi_compile_fwdbase
    53.             #pragma multi_compile_fog
    54.             #pragma exclude_renderers xbox360 ps3
    55.             #pragma target 3.0
    56.             uniform float _Slope;
    57.             uniform float4 _Color;
    58.             uniform sampler2D _Gradient; uniform float4 _Gradient_ST;
    59.             uniform float _Transparency;
    60.             uniform sampler2D _Corners; uniform float4 _Corners_ST;
    61.             uniform float _GradientScale;
    62.             struct VertexInput {
    63.                 float4 vertex : POSITION;
    64.                 float2 texcoord0 : TEXCOORD0;
    65.             };
    66.             struct VertexOutput {
    67.                 float4 pos : SV_POSITION;
    68.                 float2 uv0 : TEXCOORD0;
    69.                 UNITY_FOG_COORDS(1)
    70.             };
    71.             VertexOutput vert (VertexInput v) {
    72.                 VertexOutput o = (VertexOutput)0;
    73.                 o.uv0 = v.texcoord0;
    74.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    75.                 UNITY_TRANSFER_FOG(o,o.pos);
    76.                 return o;
    77.             }
    78.             float4 frag(VertexOutput i) : COLOR {
    79. /////// Vectors:
    80.                 float node_689 = clamp(_Slope,-1,1);
    81.                 float node_530_if_leA = step(node_689,0.0);
    82.                 float node_530_if_leB = step(0.0,node_689);
    83.                 float node_441 = 3.141592654;
    84.                 float node_653_ang = node_441;
    85.                 float node_653_spd = 1.0;
    86.                 float node_653_cos = cos(node_653_spd*node_653_ang);
    87.                 float node_653_sin = sin(node_653_spd*node_653_ang);
    88.                 float2 node_653_piv = float2(0.5,0.5);
    89.                 float2 node_653 = (mul(i.uv0-node_653_piv,float2x2( node_653_cos, -node_653_sin, node_653_sin, node_653_cos))+node_653_piv);
    90.                 float2 node_485 = (node_653*float2(node_689,1.0));
    91.                 float4 node_1737 = tex2D(_Corners,TRANSFORM_TEX(node_485, _Corners));
    92.                 float node_342_ang = (node_441/(-2.0));
    93.                 float node_342_spd = 1.0;
    94.                 float node_342_cos = cos(node_342_spd*node_342_ang);
    95.                 float node_342_sin = sin(node_342_spd*node_342_ang);
    96.                 float2 node_342_piv = float2(0.5,0.5);
    97.                 float2 node_342 = (mul(i.uv0-node_342_piv,float2x2( node_342_cos, -node_342_sin, node_342_sin, node_342_cos))+node_342_piv);
    98.                 float2 node_515 = (node_342*float2(1.0,(-1*node_689)));
    99.                 float4 node_7279 = tex2D(_Corners,TRANSFORM_TEX(node_515, _Corners));
    100.                 float3 node_527 = (1.0 - node_7279.rgb);
    101.                 clip((1.0 - lerp((node_530_if_leA*node_1737.rgb)+(node_530_if_leB*node_527),node_527,node_530_if_leA*node_530_if_leB)).r - 0.5);
    102. ////// Lighting:
    103. ////// Emissive:
    104.                 float3 emissive = _Color.rgb;
    105.                 float3 finalColor = emissive;
    106.                 float2 node_679 = (node_653*float2(1.0,_GradientScale));
    107.                 float4 _Gradient_var = tex2D(_Gradient,TRANSFORM_TEX(node_679, _Gradient));
    108.                 fixed4 finalRGBA = fixed4(finalColor,lerp(_Gradient_var.rgb,float3(0,0,0),_Transparency).r);
    109.                 UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
    110.                 return finalRGBA;
    111.             }
    112.             ENDCG
    113.         }
    114.         Pass {
    115.             Name "ShadowCaster"
    116.             Tags {
    117.                 "LightMode"="ShadowCaster"
    118.             }
    119.             Offset 1, 1
    120.          
    121.             CGPROGRAM
    122.             #pragma vertex vert
    123.             #pragma fragment frag
    124.             #define UNITY_PASS_SHADOWCASTER
    125.             #include "UnityCG.cginc"
    126.             #include "Lighting.cginc"
    127.             #pragma fragmentoption ARB_precision_hint_fastest
    128.             #pragma multi_compile_shadowcaster
    129.             #pragma multi_compile_fog
    130.             #pragma exclude_renderers xbox360 ps3
    131.             #pragma target 3.0
    132.             uniform float _Slope;
    133.             uniform sampler2D _Corners; uniform float4 _Corners_ST;
    134.             struct VertexInput {
    135.                 float4 vertex : POSITION;
    136.                 float2 texcoord0 : TEXCOORD0;
    137.             };
    138.             struct VertexOutput {
    139.                 V2F_SHADOW_CASTER;
    140.                 float2 uv0 : TEXCOORD1;
    141.             };
    142.             VertexOutput vert (VertexInput v) {
    143.                 VertexOutput o = (VertexOutput)0;
    144.                 o.uv0 = v.texcoord0;
    145.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    146.                 TRANSFER_SHADOW_CASTER(o)
    147.                 return o;
    148.             }
    149.             float4 frag(VertexOutput i) : COLOR {
    150. /////// Vectors:
    151.                 float node_689 = clamp(_Slope,-1,1);
    152.                 float node_530_if_leA = step(node_689,0.0);
    153.                 float node_530_if_leB = step(0.0,node_689);
    154.                 float node_441 = 3.141592654;
    155.                 float node_653_ang = node_441;
    156.                 float node_653_spd = 1.0;
    157.                 float node_653_cos = cos(node_653_spd*node_653_ang);
    158.                 float node_653_sin = sin(node_653_spd*node_653_ang);
    159.                 float2 node_653_piv = float2(0.5,0.5);
    160.                 float2 node_653 = (mul(i.uv0-node_653_piv,float2x2( node_653_cos, -node_653_sin, node_653_sin, node_653_cos))+node_653_piv);
    161.                 float2 node_485 = (node_653*float2(node_689,1.0));
    162.                 float4 node_1737 = tex2D(_Corners,TRANSFORM_TEX(node_485, _Corners));
    163.                 float node_342_ang = (node_441/(-2.0));
    164.                 float node_342_spd = 1.0;
    165.                 float node_342_cos = cos(node_342_spd*node_342_ang);
    166.                 float node_342_sin = sin(node_342_spd*node_342_ang);
    167.                 float2 node_342_piv = float2(0.5,0.5);
    168.                 float2 node_342 = (mul(i.uv0-node_342_piv,float2x2( node_342_cos, -node_342_sin, node_342_sin, node_342_cos))+node_342_piv);
    169.                 float2 node_515 = (node_342*float2(1.0,(-1*node_689)));
    170.                 float4 node_7279 = tex2D(_Corners,TRANSFORM_TEX(node_515, _Corners));
    171.                 float3 node_527 = (1.0 - node_7279.rgb);
    172.                 clip((1.0 - lerp((node_530_if_leA*node_1737.rgb)+(node_530_if_leB*node_527),node_527,node_530_if_leA*node_530_if_leB)).r - 0.5);
    173.                 SHADOW_CASTER_FRAGMENT(i)
    174.             }
    175.             ENDCG
    176.         }
    177.     }
    178.     FallBack "Diffuse"
    179.     CustomEditor "ShaderForgeMaterialInspector"
    180. }
    181.  
    182.  
    more info here
    http://answers.unity3d.com/questions/980924/ui-mask-with-shader.html
     
  2. WalterBoyd

    WalterBoyd

    Joined:
    Sep 25, 2015
    Posts:
    13
    Awesome, thanks!
     
  3. WalterBoyd

    WalterBoyd

    Joined:
    Sep 25, 2015
    Posts:
    13
    Rorakin, may I ask for some more help? When you mouse-over a dot on the graph you get a nice tooltip. I've overridden the script to show my own text, which I found straight forward. But I will be using this in a tablet environment, so mouseover doesn't really apply. I would like to be able to tap a dot to make this tooltip pop, and I'd also like the tooltip to include it's own button that would allow the user to drill into more details. Do you have any thoughts or suggested directions that would help me implement this feature?
     
  4. eaiinfo

    eaiinfo

    Joined:
    Oct 29, 2014
    Posts:
    7
    Rorakin,
    I have a scatterplot prefab and I am seeing significant fps loss when changing the position of my points.
    I have 200 points.
    I use setDataProvider to set to class that contains a List<Vector2>.
    I'm updating a point in that list every frame with a new location.
    So, If the point I update it with doesn't change my frame rate stays good. As soon as I start modifying some points the frame rate drops.
    http://prntscr.com/8mp0hz
    You can see the list of points all zero except elements 184-192 which were all just set. In the profiler you can see The spike in loss of framerate.
    What can I do to speed things up.
     
  5. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey, of course you can ask for more help! For this case, the event WMG_Click should do what you want. Here is code of a custom script, that when you click on a point or bar will log to the console the series and node that was clicked Just assign the myGraph variable to your graph and it should work. Of course you will want to edit MyCustomFunction to do all those things you mentioned :)

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class GraphPointInteraction : MonoBehaviour {
    6.  
    7.     public WMG_Axis_Graph myGraph;
    8.  
    9.     void MyCustomFunction(WMG_Series series, WMG_Node node) {
    10.         Debug.Log("Node: " + node.name + " on series: " + series.name + " was clicked!");
    11.     }
    12.  
    13.     void Start() {
    14.         myGraph.WMG_Click += MyCustomFunction;
    15.     }
    16.  
    17. }
    18.  
     
  6. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey there,
    I notice from some of the functions in the profiler that you are using Graph Maker 1.4, is it possible for you to upgrade to Graph Maker 1.5.1 ? (Requires Unity 5.1.2+ to download from the store right now, but I will be uploading a new package soon that will make it so you get latest version of Graph Maker with Unity 5.0.0+ instead of 5.1.2+).
    I am fairly certain that will speed it up alot, but if not I will look into it further. Also, you are only changing 1 of 200 of the Vector2's every frame?
     
  7. eaiinfo

    eaiinfo

    Joined:
    Oct 29, 2014
    Posts:
    7
    Yup currently only changing one per frame via reflection. Unity 4.6.8f1
     
  8. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Ok, so I ran some tests in Graph Maker 1.4 with Unity 4.6 and it looks like if you disable auto-animations you will get a high speed increase. Considering you are updating data every frame it does not make sense to do animations anyways. So, click on the "Anim" tab for your graph and disable the "Auto Animations Enabled" checkbox. After doing this, I was able to randomly generate a set of 200 vector2's in the Update() function and assign them to a series with no FPS issues.

    In case anyone is curious, I also tested it in Graph Maker 1.5.1 with Unity 5.2.1 and it looks auto-animations have no effect on FPS when assigning randomly generated 200 data point data set every update frame (just looks weird)
     
    Last edited: Oct 2, 2015
  9. Sk1d

    Sk1d

    Joined:
    Oct 6, 2015
    Posts:
    1
    I am using Graph maker 1.5.1 and I update a simple 2d Linegraph, where the x-axis is the time. I Update a WMG_Series with: series.pointValues.SetList (list). Every n seconds to show new points. I have the option: Max Auto Grow enabled. My problem is that the x-Axis Labels do not get updated when the Max value increases. Do I have to manually call another function to update the axis labels?

    The labels do get updated when I disable and then reenable max auto grow while the simulation is running.
     
  10. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hmm, yes this is a bug, thanks for finding it. To fix it, you can change line 762 of WMG_Axis.cs from this:
    _AxisMaxValue = newVal;
    to this
    AxisMaxValue = newVal;
     
  11. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey guys,

    Uploaded a new version with some fixes. here is the change log:

    1.5.2
    - NEW: FAQ section added to the manual, check it out!
    - FIX: Area shading graphs / custom shaders work with Unity UI masking / scroll view components.
    - FIX: The auto grow / shrink functionality updates labels / refreshes the graph.

    Thanks to @Sk1d and @WalterBoyd for finding these issues.

    The latest version of Graph Maker is now uploaded with Unity 5.0.1 instead of Unity 5.1.2. You will get Graph Maker version 1.4 when you download from the store with a Unity version less than Unity 5.0.1, I have updated the store description to make this clear. Also, I updated Graph Maker 1.4 in the store to include the tutorial code and tutorial scene created from the Youtube tutorial.

    Be sure to check out the new FAQ section (1.3) in the manual. Link here:
    http://www.rorakin.com/GraphMaker/GraphMaker.pdf

    Cheers
     
  12. cse_mfreeman

    cse_mfreeman

    Joined:
    Oct 16, 2015
    Posts:
    1
    Great graphing package! I do have one question, however. I can't seem to get any axis/graph title strings to actually display on my graphs. I've set the "Axis Title String" value on the WMG_Axis_Graph script for both axes and nothing is displayed. Is there some other value that I need to set in order for these to display next to the axes?
     
  13. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    Oh yeah that was a bug I fixed in 1.5.2. All text objects incorrectly had a horizontal overflow of truncate, but should be fixed now if you download latest version, or you can just manually set the horizontal overflow on the text object. The bug was introduced with the text mesh pro support update since my prefab updater utility didn't take that into account.
     
  14. seidensj

    seidensj

    Joined:
    Sep 10, 2014
    Posts:
    11
    Hi, is there anyway to make group labels appear intermittently like tick labels? E.g., my x-axis uses groups 1,2,3,4,5,6. However, I only want groups 1, 3, and 6 to be labeled on the x-axis.
     
  15. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    You can use label type of "Ticks" or "Ticks_Centered" and set the labels based on yours groups but skipping a set interval of labels by setting an empty string. For example:

    Code (csharp):
    1.  
    2.         int skipInterval = 2; // skip 2 labels for every label
    3.         List<string> myXlabels = new List<string> ();
    4.         for (int i = 0; i < graph.groups.Count; i++) { // for each group
    5.             if (i % (skipInterval + 1) == 0) {
    6.                 myXlabels.Add(graph.groups[i]);
    7.             }
    8.             else {
    9.                 myXlabels.Add("");
    10.             }
    11.         }
    12.         graph.xAxis.axisLabels.SetList (myXlabels); // set the labels
    13.  
    14.  
     
  16. seidensj

    seidensj

    Joined:
    Sep 10, 2014
    Posts:
    11
    Thanks for the speedy reply. My issue with using "Ticks" or "Ticks Centered" is that I can't seem to get the bars to center on the ticks like they center on they groups.

    Groups:
    Groups.png

    Ticks Center:
    TicksCenter.png

    I feel like I must be missing something obvious but I can't figure out what it it is. Here are my settings on the graph and its series:

    Graph Core:
    GraphCore-NotUsingGroups.png
    Graph xAxis:
    GraphxAxis-Settings.png
    Series Core:
    Series-Core.png
     
  17. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hmm, alright, yeah if you want the labels to match the bars instead of the ticks you have to use label type of groups.

    To skip labels for groups, I can add some configuration in the next update, but for now you can just change line 939 of WMG_Axis.cs.

    Change this
    Code (csharp):
    1.  
    2. axisLabels.SetValNoCb(i, graph.groups[i], ref _axisLabels);
    3.  
    To this

    Code (csharp):
    1.  
    2. int skipInterval = 2; // skip 2 labels for every label
    3. axisLabels.SetValNoCb(i, (i % (skipInterval + 1) == 0) ? graph.groups[i] : "", ref _axisLabels);
    4.  
     
  18. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I;m having problems. I've dropped the pie graph prefab onto my scene and nothing shows up. My scene has a UISprite as a background with a depth of 3 so your pie graph is behind my sprite, how to I make your graphs appear in front of anything on screen, I can't find a way to change the prefabs depth.
     
  19. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey there,
    Create an NGUI panel. NGUI --> Create --> Panel. Put your graphs underneath the panel, bring forward the panel depth until they appear above your other UI elements.
     
  20. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    Thanks, I'd already figured that out but thanks for the reply anyway.
     
  21. MAeStROx

    MAeStROx

    Joined:
    Mar 20, 2015
    Posts:
    15
    Hi,
    I'd like to have user-created graphs of the sort of hierarchical graph or random graph,
    but have the user add/delete nodes and links in runtime,
    is that feature currently supported?
    If not - what would it take?
    Thanks :)
     
  22. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    The Graph Maker - NGUI package has an example scene where you can add / delete / move nodes or links at run-time. Recommend importing NGUI (maybe free version works), and importing the Graph_Maker_NGUI package. All the code for that example scene is in WMG_Editor.cs. It would be a fair amount of work to port it over to the Unity GUI system if you don't want to use NGUI, but definitely doable.
     
    MAeStROx likes this.
  23. MAeStROx

    MAeStROx

    Joined:
    Mar 20, 2015
    Posts:
    15
    Ok thanks for the prompt reply, do you by any chance have plans to make the port
    to Unity GUI in future releases?
     
  24. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    No sorry not in the immediate future.
     
    MAeStROx likes this.
  25. TrophyManager

    TrophyManager

    Joined:
    Sep 9, 2015
    Posts:
    15
    Hi there,
    We just have bought your plugin (GraphMaker), a few days ago
    We are having an issue with the "Hyper-Compatible" DoTween version we use - v.1.1.060 (we are looking to export to Windows 8.1, 10):
    • Assets/Graph_Maker/Scripts/GUIDependent/WMG_Anim.cs(88,25): error CS1502: The best overloaded method match for `DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter<float>, DG.Tweening.Core.DOSetter<float>, float, float)' has some invalid arguments
    • Assets/Graph_Maker/Scripts/GUIDependent/WMG_Anim.cs(88,25): error CS1503: Argument `#1' cannot convert `DG.Tweening.Core.DOGetter<UnityEngine.Vector2>' expression to type `DG.Tweening.Core.DOGetter<float>'
    Is there any fast workaround to keep using the hyper compatible version of DOTween?
    Or... do we have to change to the standard DoTween?


    Thank you for the good work and keep it up!
     
    Last edited: Nov 17, 2015
  26. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Thanks, I can check it out, where do you get this version of DoTween?
     
  27. TrophyManager

    TrophyManager

    Joined:
    Sep 9, 2015
    Posts:
    15
    Official site (the actual version, although I think I clashes with previous Hyper-Compatible versions):
    http://dotween.demigiant.com/download.php
     
  28. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey, I will look to address this in the next update, to fix it now, you can just double click on the error in the console. You should then see the function animVec2. Then just replace
    Vector2
    with
    DG.Tweening.Core.Surrogates.Vector2Wrapper

    For the DOGetter and DOSetter in the arguments of the animVec2 function.
     
  29. TrophyManager

    TrophyManager

    Joined:
    Sep 9, 2015
    Posts:
    15
    Thank you for the excellent support!
     
  30. PeterShoferistov

    PeterShoferistov

    Joined:
    Sep 22, 2013
    Posts:
    59
    Hey! Thanks for a great asset. Got a quick question. Is it possible to make a graph to look like on the image below? If yes, could you provide any tips? Thanks!
    http://1drv.ms/1OSmgaK

    Here is what I've managed to make using graph maker, but as you see there is twice more points in here:
    https://www.dropbox.com/s/t6vt93ndppiyfhc/Screenshot 2015-11-19 15.33.28.png?dl=0

    Also after enabling shading I have some visual artifacts like here (negative fields are not filling properly):
    https://www.dropbox.com/s/sf7lo90vapn2eqq/Screenshot 2015-11-19 15.35.37.png?dl=0
     
    Last edited: Nov 19, 2015
  31. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hmm, that one is a bit tricky because there is variable width for your bars. One way I can think to do it, is to create a line chart with the lines disabled, and the points at the center of where each bar should go. And instead of using a circle prefab for the node, use a square prefab with pivot in the center of the square (this will make changing width / height easier).

    Lastly, create a function in a custom script of yours that loops over all the points in the graph and changes the height of the node based on the node's y-position, and the width of the node based on some other data where you are storing the width information. Call this function a frame after Graph Maker updates / when you create the chart. Alternately, you can call the function on the same frame if you call a Graph Maker function to update the graph immediately (more info about that in the FAQ).
     
    PeterShoferistov likes this.
  32. vrmind

    vrmind

    Joined:
    Nov 11, 2012
    Posts:
    3
    Hi, I've imported Graph Maker 1.5.2 into Unity 5.2.3, and have following errors:

    Assets/Graph_Maker/Scripts/GUIDependent/WMG_GUI_Functions.cs(154,68): error CS1502: The best overloaded method match for `UnityEngine.RectTransformUtility.WorldToScreenPoint(UnityEngine.Camera, UnityEngine.Vector3)' has some invalid arguments

    Assets/Graph_Maker/Scripts/GUIDependent/WMG_GUI_Functions.cs(154,68): error CS1503: Argument `#1' cannot convert `Camera' expression to type `UnityEngine.Camera'

    How to fix that?
    All the best!
     
  33. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    I don't have that error. I suspect you have a custom Camera class, and the compiler is checking that one first instead of the UnityEngine Camera class. You can fix it by namespacing the custom Camera class or by replacing:
    Camera cam
    with
    UnityEngine.Camera cam
     
  34. vrmind

    vrmind

    Joined:
    Nov 11, 2012
    Posts:
    3
    Thanks! Indeed, this was the problem :)
     
  35. manpower13

    manpower13

    Joined:
    Dec 22, 2013
    Posts:
    140
    Hey Rorakin,

    Thanks again for this wonderfull asset. I just updated to your latest version, 1.5.2.
    I think you should make sure to create a: upgrade to 1.5 manual in your big manual next time. You don't want users to be thinking about what WMG_List does to change the points if a graph. I discovered later you need to use .SetList for example.
    It is not a complain, but something that is easily made from your side and definitly something users would appreciate ;)

    Another thing that might be a cool feature:
    Inside the hierarchical tree to automaticly detect the width and height of the object instead of manually typing the X and Y length. You could use the recttransform width and height.

    Also a question, is it possible to make the hierarchical tree resize based on the screen width and height? Just like most components do in the new Unity Gui?

    Thank you for your time and you great code,
    Floris Weers
     
  36. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    Yeah no problem. I will be sure to add a little upgrade guide for 1.4.x -> 1.5.x in the manual.

    Yeah, for the hierarchical tree, I can look to do some improvements, It's been awhile since I updated it. Just so I'm not misunderstanding, you want the length x / y to be based on the Rect Transform width / height of the hierarchical tree, and also you want the ability for things to update size dynamically such as the size of the nodes based on the rec transform width / height (similar to how the pie graph / axis graph currently work in terms of resizing)
     
  37. manpower13

    manpower13

    Joined:
    Dec 22, 2013
    Posts:
    140
    Hi,

    Thank you for your fast respond!
    I am sure a lot of your users would appreciate that :).
    Yes that is exactly what I mean. Just like a regular Image component of the UGUI uses the rect width and height.
     
  38. seidensj

    seidensj

    Joined:
    Sep 10, 2014
    Posts:
    11
    Hi, sometimes colors are disappearing from my pie charts.

    ColorDisappear1.png ColorDisappear2.png

    Any idea on what could be causing this/how to fix it?

    I'm setting colors for different attributes like so:
    _pieGraph.sliceColors.SetList (_itemColorGraphColors);
     
  39. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    It looks like the slice is being disabled or disappearing, is there anything else you are doing? Can you send a screen of your settings? This might be easier over emails, my email is in the first post.
     
  40. Eftychios

    Eftychios

    Joined:
    Nov 4, 2010
    Posts:
    12
    Nice tool rorakin3,

    Maybe i missed something but: How do i draw a quadratic or a linear function on a WMG_Axis_Graph.
    I thought WMG_Editor would give me an idea, but seem like it is deprecated and removed.

    Cheers
     
  41. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,

    There should be GenLinear / GenQuadratic on WMG_Axis_Graph.
    You can check out the code used in the Dynamic example scene. There are instances of code in there that use GenRandom(), which will be very similar to using GenLinear and GenQuadratic.
     
  42. David_Biggs

    David_Biggs

    Joined:
    Sep 13, 2012
    Posts:
    8
    Hi Rorakin,
    "The domain rorakin.com has expired" so I cant download your docs. I'm just wondering of graph maker uses the New Unity 4.6+ UI System? The store only mentions TextMesh Pro and NGUI.

    Thanks.
     
  43. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,
    Yeah working on that, and yes Graph Maker uses Unity 4.6+ UI System.
     
  44. yuererererererererererererere

    yuererererererererererererere

    Joined:
    Jan 6, 2016
    Posts:
    1
    please,how to make realtime curve graph?the x-axis is time ,y-axis is data get from the Kinect(I have the data ) ?
     
  45. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hi, you have looked at the example scene X_Dynamic for real-time update? Can you email me more info? My email is on the first post.
     
  46. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey guys,
    Here is a little teaser for the next update:

    AreaShadingSample1.png

    A new example scene featuring the above will be included. The new example scene features how to override labeling functions for all of graph maker's labeling without touching any graph maker code, such as axes labels and tooltip labels. In this example $ has been added.

    The scene also demonstrates how to animate plot points overtime using a simple coroutine function. This is similar to the real-time update example in the dynamic example scene.

    The main advantage of graph maker's real-time update example over the simple coroutine function in this scene is that the real-time update works better if you need to plot data every frame / data changing extremely often. This helps with performance since the real-time update analyzes slope differentials and only plots points when previous vs. after slopes are significantly different.

    Lastly, the area-shading shader has been much improved. The shader now works with canvas screen space overlay mode (no longer requires a camera). Also, the aliasing problems that would occur without setting pixel perfect on the canvas were fixed. All the textures used in the old shader such as the black and white corners and black to white gradient textures were replaced with UV coordinates and shader math.
     
    manpower13 likes this.
  47. manpower13

    manpower13

    Joined:
    Dec 22, 2013
    Posts:
    140
    Looks very promising!
     
  48. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    New version just uploaded!

    Be sure to check out the new awesome Demo Scene built via WebGL, link will be in the asset store as well!

    1.5.3
    - NEW: New example scene that animate plots data overtime, scene code also shows how to override all labeling functions.
    - NEW: Options added for axes for label skipping (e.g. only label every other label on y-axis).
    - CHANGE: Hierarchical tree width / height now based off Rect Transform.
    - FIX: Improved shaders - The aliasing / artifacting for area shading is gone, even without pixel perfect set on canvas.
    - FIX: Graph tooltip can no longer go beyond the screen edge.
    - FIX: Ring graph labels intelligently stack (e.g. rings corresponding with the same value).
     
  49. Snipe3000

    Snipe3000

    Joined:
    Aug 31, 2013
    Posts:
    8
    I had GraphMaker 1.4 working in Unity 4.6. Now we have upgraded to GraphMaker 1.5.2 for Unity 5.3.1, but I'm getting errors just trying to make the basic graph shown in the tutorial.
    I'm getting 3 errors in WMG_Axis_Graph.cs:

    NullReferenceException: Object reference not set to an instance of an object
    WMG_Axis_Graph.Init () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:397)
    WMG_Axis_Graph.Start () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:379)

    NullReferenceException: Object reference not set to an instance of an object
    WMG_Axis_Graph.updateFromResize () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:482)
    WMG_Axis_Graph.Update () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:434)

    NullReferenceException: Object reference not set to an instance of an object
    WMG_Axis_Graph.ResumeCallbacks () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:460)
    WMG_Axis_Graph.Refresh () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:440)
    WMG_Axis_Graph.Update () (at Assets/Graph_Maker/Scripts/Graphs/WMG_Axis_Graph.cs:436)

    Is there a fix for this?
     
  50. rorakin3

    rorakin3

    Joined:
    Jan 2, 2013
    Posts:
    464
    Hey,

    I suspect you are trying to use Graph Maker 1.4 graph in your project with Graph Maker 1.5+. Unfortunately, graphs created with version 1.4 are not usable with 1.5+ since there are too many changes across these versions.