Ejemplo n.º 1
0
 protected override double MinValue(AxisBase axis)
 {
     if (axis == null)
     {
         return(0.0);
     }
     if (axis == mHorizontalAxis)
     {
         return(((IInternalCandleData)Data).GetMinValue(0, false));
     }
     if (axis == mVerticalAxis)
     {
         return(((IInternalCandleData)Data).GetMinValue(1, false));
     }
     return(0.0);
 }
 protected override double MaxValue(AxisBase axis)
 {
     if (axis == null)
     {
         return(0.0);
     }
     if (axis == mHorizontalAxis)
     {
         return(0.0);
     }
     if (axis == mVerticalAxis)
     {
         return(((IInternalBarData)Data).GetMaxValue());
     }
     return(0.0);
 }
 protected override bool HasValues(AxisBase axis)
 {
     if (axis == null)
     {
         return(false);
     }
     if (axis == mHorizontalAxis)
     {
         return(false);
     }
     if (axis == mVerticalAxis)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
 protected override bool HasValues(AxisBase axis)
 {
     return(true); //all axis have values in the graph chart
 }
Ejemplo n.º 5
0
 double IInternalUse.InternalMinValue(AxisBase axis)
 {
     return(MinValue(axis));
 }
Ejemplo n.º 6
0
 bool IInternalUse.InternalHasValues(AxisBase axis)
 {
     return(HasValues(axis));
 }
Ejemplo n.º 7
0
        internal protected virtual IAxisGenerator InternalUpdateAxis(ref GameObject axisObject, AxisBase axisBase, ChartOrientation axisOrientation, bool isSubDiv, bool forceRecreate, double scrollOffset)
        {
            IAxisGenerator res = null;

            if (axisObject == null || forceRecreate || CanvasChanged)
            {
                ChartCommon.SafeDestroy(axisObject);
                GameObject axis = null;
                if (IsUnderCanvas)
                {
                    axis = ChartCommon.CreateCanvasChartItem();
                }
                else
                {
                    axis = ChartCommon.CreateChartItem();
                }
                axisBase.ClearFormats();
                axis.transform.SetParent(transform, false);
                axis.transform.localScale    = new Vector3(1f, 1f, 1f);
                axis.transform.localRotation = Quaternion.identity;
                axis.transform.localPosition = new Vector3();
                axis.layer = gameObject.layer; // put the axis on the same layer as the chart
                ChartCommon.HideObject(axis, hideHierarchy);
                axisObject = axis;
                if (IsUnderCanvas)
                {
                    res = axis.AddComponent <CanvasAxisGenerator>();
                }
                else
                {
                    res = axis.AddComponent <AxisGenerator>();
                }
            }
            else
            {
                if (IsUnderCanvas)
                {
                    res = axisObject.GetComponent <CanvasAxisGenerator>();
                }
                else
                {
                    res = axisObject.GetComponent <AxisGenerator>();
                }
            }
            res.SetAxis(scrollOffset, this, axisBase, axisOrientation, isSubDiv);

            //      axisObject.transform.localScale = new Vector3(1f, 1f, 1f);
            //       axisObject.transform.localRotation = Quaternion.identity;
            //       axisObject.transform.localPosition = new Vector3();
            return(res);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// returns the minimum value for the specified axis , or 0 if HasValues(axis) returns false.
 /// the minimum value is usually determined by the chart data source , and can be mannualy overriden by the user
 /// </summary>
 protected abstract double MinValue(AxisBase axis);
Ejemplo n.º 9
0
 /// <summary>
 /// Given an axis component , this method would return true if that axis is supported for this chart type.
 /// for example: if the chart supports only horizontal axis , this method should return true for horizontal axis and false otherwise
 /// This method is used by the axis drawing method to determine if this chart type provides data for an axis. (if not then the axis is drawn without values
 /// </summary>
 /// <param name="axis"></param>
 /// <returns></returns>
 protected abstract bool HasValues(AxisBase axis);
Ejemplo n.º 10
0
 protected override double MinValue(AxisBase axis)
 {
     return(0.0);
 }
Ejemplo n.º 11
0
 protected override bool HasValues(AxisBase axis)
 {
     return(false);
 }
Ejemplo n.º 12
0
        public override void OnInspectorGUI()
        {
            AxisBase axis = (AxisBase)target;

            if (axis.gameObject == null)
            {
                return;
            }

            AnyChart chart = axis.gameObject.GetComponent <AnyChart>();

            if (chart == null)
            {
                return;
            }
            if ((chart is AxisChart) == false)
            {
                EditorGUILayout.LabelField(string.Format("Chart of type {0} does not support axis", chart.GetType().Name));
                return;
            }
            SerializedProperty simpleViewProp = serializedObject.FindProperty("SimpleView");

            if (simpleViewProp == null)
            {
                return;
            }

            Type canvasType = (chart is ICanvas) ? typeof(CanvasAttribute) : typeof(NonCanvasAttribute);

            EditorGUILayout.BeginVertical();
            bool negate = false;

            if (simpleViewProp.boolValue == true)
            {
                negate = GUILayout.Button("Advanced View");
            }
            else
            {
                negate = GUILayout.Button("Simple View");
            }
            if (negate)
            {
                simpleViewProp.boolValue = !simpleViewProp.boolValue;
            }
            bool simple = simpleViewProp.boolValue;


            SerializedProperty depth = serializedObject.FindProperty("depth");

            if (depth != null)
            {
                EditorGUILayout.PropertyField(depth);
            }
            SerializedProperty format = serializedObject.FindProperty("format");

            EditorGUILayout.PropertyField(format);
            if (simple)
            {
                DoSimpleView(canvasType);
            }
            else
            {
                DoAdvanvedView(canvasType, true);
            }

            EditorGUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
            serializedObject.Update();
        }
 protected override double MaxValue(AxisBase axis)
 {
     return 0.0;
 }
Ejemplo n.º 14
0
 protected override bool HasValues(AxisBase axis)
 {
     return true;
 }