#define Graph_And_Chart_PRO
using ChartAndGraph.Axis;
using ChartAndGraph.DataSource;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace ChartAndGraph
{
///
/// this is a base class for all chart types
///
[Serializable]
public abstract class AnyChart : MonoBehaviour, IInternalUse, ISerializationCallbackReceiver
{
private Vector2 mLastSetSize = Vector2.zero;
private bool mGenerating = false;
private Dictionary mHorizontalValueToStringMap = new Dictionary(ChartCommon.DefaultDoubleComparer);
private Dictionary mVerticalValueToStringMap = new Dictionary(ChartCommon.DefaultDoubleComparer);
private Dictionary> mVectorToValueMap = new Dictionary>(ChartCommon.DefaultDoubleVector3Comparer);
private HashSet mHorizontalCustomAxis = new HashSet(), mVerticalCustomAxis = new HashSet();
private HashSet mHorizontalCustomAxisSubDivision = new HashSet(), mVerticalCustomAxisSubdivision = new HashSet();
protected GameObject mFixPosition = null;
[SerializeField]
[HideInInspector]
protected GameObject mPreviewObject;
public void RemoveHorizontalAxisDivision(double pos)
{
mHorizontalCustomAxis.Remove(pos);
mHorizontalCustomAxisSubDivision.Remove(pos);
Invalidate();
}
public void AddHorizontalAxisDivision(double pos, bool subDivision = false)
{
if (subDivision)
mHorizontalCustomAxisSubDivision.Add(pos);
else
mHorizontalCustomAxis.Add(pos);
Invalidate();
}
public void ClearHorizontalCustomDivisions()
{
mHorizontalCustomAxis.Clear();
mHorizontalCustomAxisSubDivision.Clear();
Invalidate();
}
public void RemoveVerticalAxisDivision(double pos)
{
mVerticalCustomAxis.Remove(pos);
mVerticalCustomAxisSubdivision.Remove(pos);
Invalidate();
}
public void AddVerticalAxisDivision(double pos, bool subDivision = false)
{
if (subDivision)
mVerticalCustomAxisSubdivision.Add(pos);
else
mVerticalCustomAxis.Add(pos);
Invalidate();
}
public void ClearVerticalCustomDivisions()
{
mVerticalCustomAxis.Clear();
mVerticalCustomAxisSubdivision.Clear();
Invalidate();
}
HashSet IInternalUse.VerticalCustomAxis { get { return mVerticalCustomAxis; } }
HashSet IInternalUse.HorizontalCustomAxis { get { return mHorizontalCustomAxis; } }
HashSet IInternalUse.VerticalCustomAxisSubDivision { get { return mVerticalCustomAxisSubdivision; } }
HashSet IInternalUse.HorizontalCustomAxisSubDivision { get { return mHorizontalCustomAxisSubDivision; } }
Func customNumberFormat;
public Func CustomNumberFormat
{
get { return customNumberFormat; }
set
{
customNumberFormat = value;
Invalidate();
}
}
Func customDateTimeFormat;
public Func CustomDateTimeFormat
{
get { return customDateTimeFormat; }
set
{
customDateTimeFormat = value;
Invalidate();
}
}
public Dictionary> VectorValueToStringMap
{
get { return mVectorToValueMap; }
}
public Dictionary VerticalValueToStringMap
{
get { return mVerticalValueToStringMap; }
}
public Dictionary HorizontalValueToStringMap
{
get { return mHorizontalValueToStringMap; }
}
protected virtual Camera TextCameraLink
{
get { return null; }
}
protected virtual float TextIdleDistanceLink
{
get { return 20f; }
}
public UnityEvent OnRedraw = new UnityEvent();
[SerializeField]
private bool keepOrthoSize = false;
public bool KeepOrthoSize
{
get { return keepOrthoSize; }
set
{
KeepOrthoSize = value;
GenerateChart();
}
}
[SerializeField]
private bool paperEffectText = false;
public bool PaperEffectText
{
get { return paperEffectText; }
set
{
paperEffectText = value;
GenerateChart();
}
}
[SerializeField]
private bool vRSpaceText = false;
public bool VRSpaceText
{
get { return vRSpaceText; }
set
{
vRSpaceText = value;
GenerateChart();
}
}
[SerializeField]
private float vRSpaceScale = 0.1f;
public float VRSpaceScale
{
get { return vRSpaceScale; }
set
{
vRSpaceScale = value;
GenerateChart();
}
}
[SerializeField]
private bool maintainLabelSize = false;
public bool MaintainLabelSize
{
get { return maintainLabelSize; }
set
{
maintainLabelSize = value;
GenerateChart();
}
}
HashSet