graph chart引入&骑行结果弹窗
This commit is contained in:
1 parent
40d118cea3
commit
96f3644b5b
2374 files changed
+485161
-2410
No files matched your search
@@ -0,0 +1,55 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// this class holds a float value that can be either set mannualy or be set automatically by an external class
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct AutoFloat
|
||||
{
|
||||
/// <summary>
|
||||
/// true if the value is automatic
|
||||
/// </summary>
|
||||
public bool Automatic;
|
||||
/// <summary>
|
||||
/// the mannual value , this is only relevant if Automatic == false
|
||||
/// </summary>
|
||||
public float Value;
|
||||
|
||||
/// <summary>
|
||||
/// creats a new instance of AutoFloat
|
||||
/// </summary>
|
||||
/// <param name="automatic"></param>
|
||||
/// <param name="value"></param>
|
||||
public AutoFloat(bool automatic,float value)
|
||||
{
|
||||
Automatic = automatic;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if(obj is AutoFloat)
|
||||
{
|
||||
AutoFloat cast = (AutoFloat)obj;
|
||||
if (cast.Automatic == true && Automatic == true)
|
||||
return true;
|
||||
if (cast.Automatic == false && Automatic == false && cast.Value == Value)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (Automatic == true)
|
||||
return Automatic.GetHashCode();
|
||||
return Value.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6595b44672cf1b468860d62030e1c4d
|
||||
timeCreated: 1479209594
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,602 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// base class for all axis monobehaviours. This class contains paramets for defining chart axis
|
||||
/// </summary>
|
||||
public abstract class AxisBase : ChartSettingItemBase, ISerializationCallbackReceiver
|
||||
{
|
||||
#pragma warning disable 0414
|
||||
/// <summary>
|
||||
/// used internally by the axis inspector
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private bool SimpleView = true;
|
||||
#pragma warning restore 0414
|
||||
/// <summary>
|
||||
/// the format of the axis labels. This can be either a number, time or date time. If the selected value is either DateTime or Time , user ChartDateUtillity to convert dates to double values that can be set to the chart.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Tooltip("the format of the axis labels. This can be either a number, time or date time. If the selected value is either DateTime or Time , user ChartDateUtillity to convert dates to double values that can be set to the graph")]
|
||||
private AxisFormat format;
|
||||
|
||||
/// <summary>
|
||||
/// the format of the axis labels. This can be either a number, time or date time. If the selected value is either DateTime or Time , user ChartDateUtillity to convert dates to double values that can be set to the chart.
|
||||
/// </summary>
|
||||
public AxisFormat Format
|
||||
{
|
||||
get { return format; }
|
||||
set
|
||||
{
|
||||
format = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the depth of the axis reltive to the chart position
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Tooltip("the depth of the axis reltive to the chart position")]
|
||||
private AutoFloat depth;
|
||||
public AutoFloat Depth
|
||||
{
|
||||
get { return depth; }
|
||||
set { depth = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("The main divisions of the chart axis")]
|
||||
[FormerlySerializedAs("MainDivisions")]
|
||||
private ChartMainDivisionInfo mainDivisions = new ChartMainDivisionInfo();
|
||||
|
||||
[SerializeField]
|
||||
[Tooltip("The sub divisions of each main division")]
|
||||
[FormerlySerializedAs("SubDivisions")]
|
||||
private ChartSubDivisionInfo subDivisions = new ChartSubDivisionInfo();
|
||||
|
||||
|
||||
private Dictionary<double, string> mFormats = new Dictionary<double, string>();
|
||||
private List<double> mTmpToRemove = new List<double>();
|
||||
/// <summary>
|
||||
/// the main division properies for this axis
|
||||
/// </summary>
|
||||
public ChartMainDivisionInfo MainDivisions { get { return mainDivisions; } }
|
||||
/// <summary>
|
||||
/// the sub division properies for this axis
|
||||
/// </summary>
|
||||
public ChartDivisionInfo SubDivisions { get { return subDivisions; } }
|
||||
public void ClearFormats()
|
||||
{
|
||||
mFormats.Clear();
|
||||
}
|
||||
public AxisBase()
|
||||
{
|
||||
AddInnerItems();
|
||||
}
|
||||
private void AddInnerItems()
|
||||
{
|
||||
AddInnerItem(MainDivisions);
|
||||
AddInnerItem(SubDivisions);
|
||||
}
|
||||
/// <summary>
|
||||
/// used internally to hold data required for updating the axis lables
|
||||
/// </summary>
|
||||
internal class TextData
|
||||
{
|
||||
public ChartDivisionInfo info;
|
||||
public float interp;
|
||||
public int fractionDigits;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// checks that all properies of this instance have valid values. This method is used internally and should not be called
|
||||
/// </summary>
|
||||
public void ValidateProperties()
|
||||
{
|
||||
mainDivisions.ValidateProperites();
|
||||
subDivisions.ValidateProperites();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// retrieves the begining and end division of the chart
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="orientation"></param>
|
||||
/// <param name="total"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="end"></param>
|
||||
private void GetStartEnd(AnyChart parent, ChartOrientation orientation, float total, out float start, out float end)
|
||||
{
|
||||
start = 0;
|
||||
end = total;
|
||||
// if ((orientation == ChartOrientation.Horizontal) ? parent.Frame.Left.Visible : parent.Frame.Bottom.Visible)
|
||||
// ++start;
|
||||
// if ((orientation == ChartOrientation.Horizontal) ? parent.Frame.Right.Visible : parent.Frame.Top.Visible)
|
||||
// --end;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the uv of a chart mesh based on the current length and offset
|
||||
/// </summary>
|
||||
/// <param name="mesh"></param>
|
||||
/// <param name="length"></param>
|
||||
/// <param name="offset"></param>
|
||||
private void SetMeshUv(IChartMesh mesh, float length,float offset)
|
||||
{
|
||||
if (length < 0)
|
||||
offset -= length;
|
||||
mesh.Length = length;
|
||||
mesh.Offset = offset;
|
||||
}
|
||||
|
||||
private void DrawDivisions(double scrollOffset, AnyChart parent, Transform parentTransform, ChartDivisionInfo info, IChartMesh mesh, int group, ChartOrientation orientation, double gap, bool oppositeSide, double mainGap)
|
||||
{
|
||||
//scrollOffset = -scrollOffset;
|
||||
double parentSize = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalHeight : ((IInternalUse)parent).InternalTotalWidth;
|
||||
DoubleVector3 startPosition, lengthDirection, advanceDirection;
|
||||
GetDirectionVectors(parent, info, orientation, 0f, oppositeSide, out startPosition, out lengthDirection, out advanceDirection);
|
||||
double markDepth = ChartCommon.GetAutoDepth(parent, orientation, info);
|
||||
double length = ChartCommon.GetAutoLength(parent, orientation, info);
|
||||
double backLength = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalWidth : ((IInternalUse)parent).InternalTotalHeight;
|
||||
|
||||
if (info.MarkBackLength.Automatic == false)
|
||||
backLength = info.MarkBackLength.Value;
|
||||
|
||||
double totaluv = Math.Abs(length);
|
||||
if (backLength != 0 && markDepth > 0)
|
||||
totaluv += Math.Abs(backLength) + Math.Abs(markDepth);
|
||||
|
||||
DoubleVector3 halfThickness = advanceDirection * (info.MarkThickness * 0.5f);
|
||||
// if (scrollOffset != 0f)
|
||||
// last--;
|
||||
|
||||
bool hasValues = ((IInternalUse)parent).InternalHasValues(this);
|
||||
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
|
||||
double minValue = ((IInternalUse)parent).InternalMinValue(this);
|
||||
double range = maxValue - minValue;
|
||||
|
||||
float AutoAxisDepth = Depth.Value;
|
||||
// float scrollFactor = (scrollOffset / (float)(maxValue - minValue));
|
||||
//scrollOffset = scrollFactor * parentSize;
|
||||
|
||||
if (Depth.Automatic)
|
||||
{
|
||||
AutoAxisDepth = (float)((((IInternalUse)parent).InternalTotalDepth) - markDepth);
|
||||
}
|
||||
|
||||
double startValue = (scrollOffset + minValue);
|
||||
double endValue = (scrollOffset + maxValue) + double.Epsilon;
|
||||
double direction = 1.0;
|
||||
Func<double, double> ValueToPosition = x => ((x - startValue) / range) * parentSize;
|
||||
if (startValue > endValue)
|
||||
{
|
||||
direction = -1.0;
|
||||
//ValueToPosition = x => (1.0- ((x - startValue) / range)) * parentSize;
|
||||
}
|
||||
gap = Math.Abs(gap);
|
||||
double fraction = gap - (scrollOffset - Math.Floor((scrollOffset / gap) - double.Epsilon) * gap);
|
||||
double mainfraction = -1f;
|
||||
double currentMain = 0f;
|
||||
|
||||
if (mainGap > 0f)
|
||||
{
|
||||
mainfraction = mainGap - (scrollOffset - Math.Floor((scrollOffset / mainGap) - double.Epsilon) * mainGap);
|
||||
currentMain = (scrollOffset + minValue + mainfraction);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
mTmpToRemove.Clear();
|
||||
double startRange = startValue + fraction;
|
||||
foreach (double key in mFormats.Keys)
|
||||
{
|
||||
if (key* direction > endValue* direction || key* direction < startRange* direction)
|
||||
mTmpToRemove.Add(key);
|
||||
}
|
||||
for(int k=0; k<mTmpToRemove.Count; k++)
|
||||
mFormats.Remove(mTmpToRemove[k]);
|
||||
for (double current = startRange; direction*current <= direction*endValue; current += gap*direction)
|
||||
{
|
||||
|
||||
++i;
|
||||
if (i > 3000)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (mainGap > 0.0)
|
||||
{
|
||||
if(Math.Abs(current - currentMain) < 0.00001)
|
||||
{
|
||||
currentMain += mainGap;
|
||||
continue;
|
||||
}
|
||||
if(current > currentMain)
|
||||
{
|
||||
currentMain += mainGap;
|
||||
}
|
||||
}
|
||||
|
||||
double offset = ValueToPosition(current);
|
||||
if (offset < 0 || offset > parentSize)
|
||||
continue;
|
||||
DoubleVector3 start = startPosition + advanceDirection * offset;
|
||||
DoubleVector3 size = halfThickness + length * lengthDirection;
|
||||
start -= halfThickness;
|
||||
//size += halfThickness;
|
||||
float uvoffset = 0f;
|
||||
|
||||
Rect r = ChartCommon.FixRect(new Rect((float)start.x, (float)start.y, (float)size.x, (float)size.y));
|
||||
|
||||
SetMeshUv(mesh, (float)(-length / totaluv), uvoffset);
|
||||
uvoffset += Math.Abs(mesh.Length);
|
||||
|
||||
mesh.AddXYRect(r, group, AutoAxisDepth);
|
||||
if (hasValues)
|
||||
{
|
||||
double val = Math.Round(current*1000.0)/1000.0;
|
||||
string toSet = "";
|
||||
double keyVal = val;// (int)Math.Round(val);
|
||||
var dic = (orientation == ChartOrientation.Horizontal) ? parent.HorizontalValueToStringMap : parent.VerticalValueToStringMap;
|
||||
if (!(Math.Abs(val - keyVal) < 0.001 && dic.TryGetValue(keyVal, out toSet)))
|
||||
{
|
||||
if (mFormats.TryGetValue(val, out toSet) == false)
|
||||
{
|
||||
if (format == AxisFormat.Number)
|
||||
toSet = ChartAdancedSettings.Instance.FormatFractionDigits(info.FractionDigits, val, parent.CustomNumberFormat);
|
||||
else
|
||||
{
|
||||
DateTime date = ChartDateUtility.ValueToDate(val);
|
||||
if (format == AxisFormat.DateTime)
|
||||
toSet = ChartDateUtility.DateToDateTimeString(date, parent.CustomDateTimeFormat);
|
||||
else
|
||||
{
|
||||
if (format == AxisFormat.Date)
|
||||
toSet = ChartDateUtility.DateToDateString(date);
|
||||
else
|
||||
toSet = ChartDateUtility.DateToTimeString(date);
|
||||
}
|
||||
}
|
||||
toSet = info.TextPrefix + toSet + info.TextSuffix;
|
||||
mFormats[val] = toSet;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
toSet = info.TextPrefix + toSet + info.TextSuffix;
|
||||
}
|
||||
|
||||
|
||||
DoubleVector3 textPos = new DoubleVector3(start.x, start.y);
|
||||
textPos += lengthDirection * info.TextSeperation;
|
||||
TextData userData = new TextData();
|
||||
userData.interp = (float)(offset/parentSize);
|
||||
userData.info = info;
|
||||
userData.fractionDigits = info.FractionDigits;
|
||||
mesh.AddText(parent, info.TextPrefab, parentTransform, info.FontSize, info.FontSharpness, toSet, (float)textPos.x, (float)textPos.y, AutoAxisDepth + info.TextDepth, 0f, userData);
|
||||
}
|
||||
|
||||
if (markDepth > 0)
|
||||
{
|
||||
if (orientation == ChartOrientation.Horizontal)
|
||||
{
|
||||
SetMeshUv(mesh,(float)( markDepth / totaluv), uvoffset);
|
||||
r = ChartCommon.FixRect(new Rect((float)start.x, AutoAxisDepth, (float)size.x, (float)markDepth));
|
||||
mesh.AddXZRect(r, group, (float)start.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMeshUv(mesh,(float) (-markDepth / totaluv), uvoffset);
|
||||
r = ChartCommon.FixRect(new Rect((float)start.y, AutoAxisDepth, (float)size.y, (float)markDepth));
|
||||
mesh.AddYZRect(r, group, (float)start.x);
|
||||
}
|
||||
|
||||
uvoffset += Math.Abs(mesh.Length);
|
||||
|
||||
if (backLength != 0)
|
||||
{
|
||||
SetMeshUv(mesh, (float)(backLength / totaluv), uvoffset);
|
||||
uvoffset += Math.Abs(mesh.Length);
|
||||
DoubleVector3 backSize = halfThickness + backLength * lengthDirection;
|
||||
Rect backR = ChartCommon.FixRect(new Rect((float)start.x, (float)start.y, (float)backSize.x, (float)backSize.y));
|
||||
mesh.AddXYRect(backR, group, (float)(AutoAxisDepth + markDepth));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Debug.Log("start");
|
||||
// Debug.Log(mFormats.Count);
|
||||
// Debug.Log(cached);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// used internally to draw the division of the axis into a chart mesh
|
||||
// /// </summary>
|
||||
// /// <param name="parent"></param>
|
||||
// /// <param name="parentTransform"></param>
|
||||
// /// <param name="info"></param>
|
||||
// /// <param name="mesh"></param>
|
||||
// /// <param name="group"></param>
|
||||
// /// <param name="orientation"></param>
|
||||
// /// <param name="totalDivisions"></param>
|
||||
// /// <param name="oppositeSide"></param>
|
||||
// /// <param name="skip"></param>
|
||||
// private void DrawDivisions(float scrollOffset,AnyChart parent, Transform parentTransform, ChartDivisionInfo info, IChartMesh mesh, int group, ChartOrientation orientation, float totalDivisions, bool oppositeSide, int skip)
|
||||
// {
|
||||
// //scrollOffset = -scrollOffset;
|
||||
// float parentSize = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalHeight : ((IInternalUse)parent).InternalTotalWidth;
|
||||
// Vector2 startPosition, lengthDirection, advanceDirection;
|
||||
// GetDirectionVectors(parent, info, orientation, 0f, oppositeSide, out startPosition, out lengthDirection, out advanceDirection);
|
||||
// float markDepth = ChartCommon.GetAutoDepth(parent, orientation, info);
|
||||
// float length = ChartCommon.GetAutoLength(parent, orientation, info);
|
||||
// float backLength = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalWidth : ((IInternalUse)parent).InternalTotalHeight;
|
||||
|
||||
// if (info.MarkBackLength.Automatic == false)
|
||||
// backLength = info.MarkBackLength.Value;
|
||||
|
||||
// float totaluv = Math.Abs(length);
|
||||
// if (backLength != 0 && markDepth > 0)
|
||||
// totaluv += Math.Abs(backLength) + Math.Abs(markDepth);
|
||||
|
||||
// Vector2 halfThickness = advanceDirection * (info.MarkThickness * 0.5f);
|
||||
// // if (scrollOffset != 0f)
|
||||
// // last--;
|
||||
|
||||
// bool hasValues = ((IInternalUse)parent).InternalHasValues(this);
|
||||
// double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
|
||||
// double minValue = ((IInternalUse)parent).InternalMinValue(this);
|
||||
// ChartMainDivisionInfo main = info as ChartMainDivisionInfo;
|
||||
|
||||
// float divisionComplement = 0f;
|
||||
// float divisionOffsetComplement = 0f;
|
||||
// if (main != null)
|
||||
// {
|
||||
// if(main.Messure == ChartDivisionInfo.DivisionMessure.DataUnits)
|
||||
// {
|
||||
// if (main.UnitsPerDivision <= 0.0001f)
|
||||
// return;
|
||||
// float range = (float)(maxValue - minValue);
|
||||
// totalDivisions = (range / main.UnitsPerDivision) + 1;
|
||||
// divisionComplement = (float)(1f - (main.UnitsPerDivision - Math.Truncate(main.UnitsPerDivision))) / range;
|
||||
// divisionOffsetComplement = (divisionComplement) * parentSize;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// float first, last;
|
||||
// GetStartEnd(parent, orientation, totalDivisions, out first, out last);
|
||||
|
||||
// float AutoAxisDepth = Depth.Value;
|
||||
// float scrollFactor = (scrollOffset / (float)(maxValue - minValue));
|
||||
// scrollOffset = scrollFactor * parentSize;
|
||||
|
||||
// if (Depth.Automatic)
|
||||
// {
|
||||
// AutoAxisDepth = (((IInternalUse)parent).InternalTotalDepth) - markDepth;
|
||||
// }
|
||||
|
||||
// float floorLast = Mathf.Floor(last);
|
||||
// for (float i = first; i < floorLast; i++)
|
||||
// {
|
||||
// if (skip != -1 && ((int)i) % skip == 0)
|
||||
// continue;
|
||||
// float factor = ((float)i) / (float)(totalDivisions - 1);
|
||||
// float offset = -scrollOffset + factor * parentSize;
|
||||
// if (scrollOffset != 0f)
|
||||
// {
|
||||
// float prevOffs = offset;
|
||||
// offset = offset - Mathf.Floor((offset / parentSize)) * parentSize;
|
||||
//// Debug.Log("prev " + prevOffs);
|
||||
//// Debug.Log("offs " + offset);
|
||||
// if (offset < prevOffs)
|
||||
// {
|
||||
// offset -= divisionOffsetComplement;
|
||||
// }
|
||||
// }
|
||||
// if (offset < 0f)
|
||||
// continue;
|
||||
// Vector2 start = startPosition + advanceDirection * offset;
|
||||
// Vector2 size = halfThickness + length * lengthDirection;
|
||||
// start -= halfThickness;
|
||||
// //size += halfThickness;
|
||||
// float uvoffset = 0f;
|
||||
|
||||
// Rect r = ChartCommon.FixRect(new Rect(start.x, start.y, size.x, size.y));
|
||||
|
||||
// SetMeshUv(mesh, -length / totaluv, uvoffset);
|
||||
// uvoffset += Math.Abs(mesh.Length);
|
||||
|
||||
// mesh.AddXYRect(r, group, AutoAxisDepth);
|
||||
|
||||
// if (hasValues)
|
||||
// {
|
||||
// float valFactor = -scrollFactor + factor;
|
||||
// if (scrollOffset != 0f)
|
||||
// {
|
||||
// float prevFact = valFactor;
|
||||
// valFactor -= Mathf.Floor(valFactor);
|
||||
// if(valFactor < prevFact)
|
||||
// {
|
||||
// valFactor -= divisionComplement;
|
||||
// }
|
||||
// }
|
||||
// //valFactor += scrollFactor;
|
||||
// double offsetPos = (maxValue - minValue) * valFactor;
|
||||
// double scroll = minValue + ((maxValue - minValue) * scrollFactor);
|
||||
// double val = scroll + offsetPos;
|
||||
// string toSet = "";
|
||||
// if (format == AxisFormat.Number)
|
||||
// toSet = ChartAdancedSettings.Instance.FormatFractionDigits(info.FractionDigits, (float)val);
|
||||
// else
|
||||
// {
|
||||
// DateTime date = ChartDateUtility.ValueToDate(val);
|
||||
// if (format == AxisFormat.DateTime)
|
||||
// toSet = ChartDateUtility.DateToDateTimeString(date);
|
||||
// else
|
||||
// {
|
||||
// if (format == AxisFormat.Date)
|
||||
// toSet = ChartDateUtility.DateToDateString(date);
|
||||
// else
|
||||
// toSet = ChartDateUtility.DateToTimeString(date);
|
||||
// }
|
||||
// }
|
||||
|
||||
// toSet = info.TextPrefix + toSet + info.TextSuffix;
|
||||
// Vector2 textPos = new Vector2(start.x, start.y);
|
||||
// textPos += lengthDirection * info.TextSeperation;
|
||||
// TextData userData = new TextData();
|
||||
// userData.interp = factor;
|
||||
// userData.info = info;
|
||||
// userData.fractionDigits = info.FractionDigits;
|
||||
// mesh.AddText(parent, info.TextPrefab, parentTransform, info.FontSize, info.FontSharpness, toSet, textPos.x, textPos.y, AutoAxisDepth + info.TextDepth,0f, userData);
|
||||
// }
|
||||
|
||||
// if (markDepth > 0)
|
||||
// {
|
||||
// if (orientation == ChartOrientation.Horizontal)
|
||||
// {
|
||||
// SetMeshUv(mesh, markDepth / totaluv, uvoffset);
|
||||
// r = ChartCommon.FixRect(new Rect(start.x, AutoAxisDepth, size.x, markDepth));
|
||||
// mesh.AddXZRect(r, group, start.y);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SetMeshUv(mesh, -markDepth / totaluv, uvoffset);
|
||||
// r = ChartCommon.FixRect(new Rect(start.y, AutoAxisDepth, size.y, markDepth));
|
||||
// mesh.AddYZRect(r, group, start.x);
|
||||
// }
|
||||
|
||||
// uvoffset += Math.Abs(mesh.Length);
|
||||
|
||||
// if (backLength != 0)
|
||||
// {
|
||||
// SetMeshUv(mesh, backLength / totaluv, uvoffset);
|
||||
// uvoffset += Math.Abs(mesh.Length);
|
||||
// Vector2 backSize = halfThickness + backLength * lengthDirection;
|
||||
// Rect backR = ChartCommon.FixRect(new Rect(start.x, start.y, backSize.x, backSize.y));
|
||||
// mesh.AddXYRect(backR, group, AutoAxisDepth + markDepth);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// used internally to determine drawing direction of the each chart division
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="orientation"></param>
|
||||
/// <param name="oppositeSide"></param>
|
||||
/// <param name="startPosition"></param>
|
||||
/// <param name="lengthDirection"></param>
|
||||
/// <param name="advanceDirection"></param>
|
||||
private void GetDirectionVectors(AnyChart parent, ChartDivisionInfo info, ChartOrientation orientation,float scrollOffset, bool oppositeSide, out DoubleVector3 startPosition, out DoubleVector3 lengthDirection, out DoubleVector3 advanceDirection)
|
||||
{
|
||||
if (orientation == ChartOrientation.Horizontal)
|
||||
{
|
||||
advanceDirection = new DoubleVector3(1f, 0f);
|
||||
if (oppositeSide)
|
||||
{
|
||||
startPosition = new DoubleVector3(scrollOffset, ((IInternalUse)parent).InternalTotalHeight);
|
||||
lengthDirection = new DoubleVector3(0f, -1f);
|
||||
return;
|
||||
}
|
||||
startPosition = new DoubleVector3(0f, 0f);
|
||||
lengthDirection = new DoubleVector3(0f, 1f);
|
||||
return;
|
||||
}
|
||||
advanceDirection = new DoubleVector3(0f, 1f);
|
||||
if (oppositeSide)
|
||||
{
|
||||
startPosition = new DoubleVector3(0f, 0f);
|
||||
lengthDirection = new DoubleVector3(1f, 0f);
|
||||
return;
|
||||
}
|
||||
startPosition = new DoubleVector3(((IInternalUse)parent).InternalTotalWidth, scrollOffset);
|
||||
lengthDirection = new DoubleVector3(-1f, 0f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// used internally , adds the axis sub divisions to the chart mesh
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="parentTransform"></param>
|
||||
/// <param name="mesh"></param>
|
||||
/// <param name="orientation"></param>
|
||||
internal void AddSubdivisionToChartMesh(double scrollOffset,AnyChart parent, Transform parentTransform, IChartMesh mesh, ChartOrientation orientation)
|
||||
{
|
||||
int total = SubDivisions.Total;
|
||||
if (total <= 1) // no need for more
|
||||
return;
|
||||
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
|
||||
double minValue = ((IInternalUse)parent).InternalMinValue(this);
|
||||
double range = maxValue - minValue;
|
||||
double? gap = GetMainGap(parent, range);
|
||||
if (gap.HasValue == false)
|
||||
return;
|
||||
double subGap = gap.Value / (total);
|
||||
mesh.Tile = ChartCommon.GetTiling(SubDivisions.MaterialTiling);
|
||||
if ((SubDivisions.Alignment & ChartDivisionAligment.Opposite) == ChartDivisionAligment.Opposite)
|
||||
DrawDivisions(scrollOffset,parent, parentTransform, SubDivisions, mesh, 0, orientation, subGap, false, gap.Value);
|
||||
if ((SubDivisions.Alignment & ChartDivisionAligment.Standard) == ChartDivisionAligment.Standard)
|
||||
DrawDivisions(scrollOffset,parent, parentTransform, SubDivisions, mesh, 0, orientation, subGap, true, gap.Value);
|
||||
}
|
||||
|
||||
double? GetMainGap(AnyChart parent, double range)
|
||||
{
|
||||
double gap = ((ChartMainDivisionInfo)MainDivisions).UnitsPerDivision;
|
||||
if (((ChartMainDivisionInfo)MainDivisions).Messure == ChartDivisionInfo.DivisionMessure.TotalDivisions)
|
||||
{
|
||||
int total = ((ChartMainDivisionInfo)MainDivisions).Total;
|
||||
if (total <= 0)
|
||||
return null;
|
||||
gap = (range / (double)(total));
|
||||
}
|
||||
return gap;
|
||||
}
|
||||
/// <summary>
|
||||
/// used internally , adds the axis main divisions to the chart mesh
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="parentTransform"></param>
|
||||
/// <param name="mesh"></param>
|
||||
/// <param name="orientation"></param>
|
||||
|
||||
internal void AddMainDivisionToChartMesh(double scrollOffset,AnyChart parent, Transform parentTransform, IChartMesh mesh, ChartOrientation orientation)
|
||||
{
|
||||
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
|
||||
double minValue = ((IInternalUse)parent).InternalMinValue(this);
|
||||
double range = maxValue - minValue;
|
||||
double? gap = GetMainGap(parent, range);
|
||||
if (gap.HasValue == false)
|
||||
return;
|
||||
mesh.Tile = ChartCommon.GetTiling(MainDivisions.MaterialTiling);
|
||||
if ((MainDivisions.Alignment & ChartDivisionAligment.Opposite) == ChartDivisionAligment.Opposite)
|
||||
DrawDivisions(scrollOffset,parent, parentTransform, MainDivisions, mesh, 0, orientation,gap.Value, false, -1);
|
||||
if ((MainDivisions.Alignment & ChartDivisionAligment.Standard) == ChartDivisionAligment.Standard)
|
||||
DrawDivisions(scrollOffset,parent, parentTransform, MainDivisions, mesh, 0, orientation, gap.Value, true, -1);
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnAfterDeserialize()
|
||||
{
|
||||
AddInnerItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae8b4348f222b8246983af20f8444169
|
||||
timeCreated: 1479124371
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration for the format of axis label data.
|
||||
/// </summary>
|
||||
public enum AxisFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// format the labels as floating point numbers
|
||||
/// </summary>
|
||||
Number,
|
||||
/// <summary>
|
||||
/// format the labels as time of day
|
||||
/// </summary>
|
||||
Time,
|
||||
/// <summary>
|
||||
/// format the labels as date only
|
||||
/// </summary>
|
||||
Date,
|
||||
/// <summary>
|
||||
/// format the labels as date and time
|
||||
/// </summary>
|
||||
DateTime,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a65b5ecb37567ff4f92e31c7b6438605
|
||||
timeCreated: 1480864086
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
namespace ChartAndGraph.Axis
|
||||
{
|
||||
public partial class AxisGenerator : MonoBehaviour,IAxisGenerator
|
||||
{
|
||||
partial void InnerFixLabels(AnyChart parent);
|
||||
partial void InnerSetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, bool isSubDivisions);
|
||||
|
||||
public void FixLabels(AnyChart parent)
|
||||
{
|
||||
InnerFixLabels(parent);
|
||||
}
|
||||
|
||||
public void SetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, bool isSubDivisions)
|
||||
{
|
||||
InnerSetAxis(scrollOffset, parent, axis, axisOrientation, isSubDivisions);
|
||||
}
|
||||
|
||||
public UnityEngine.Object This()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public GameObject GetGameObject()
|
||||
{
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d784632ef29d0444c8a7273ffbb24ab1
|
||||
timeCreated: 1560543419
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,195 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph.Axis
|
||||
{
|
||||
/// <summary>
|
||||
/// generates an axis mesh from an AxisBase settings instance.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(MeshRenderer))]
|
||||
[RequireComponent(typeof(MeshFilter))]
|
||||
[ExecuteInEditMode]
|
||||
partial class AxisGenerator
|
||||
{
|
||||
MeshRenderer mRenderer;
|
||||
MeshFilter mFilter;
|
||||
Mesh mCleanMesh;
|
||||
List<BillboardText> mTexts;
|
||||
AxisBase mAxis;
|
||||
Material mDispose;
|
||||
Material mMaterial;
|
||||
float mTiling=1f;
|
||||
WorldSpaceChartMesh mMesh;
|
||||
Mesh mCreated;
|
||||
double mScroll = 0f;
|
||||
AnyChart mParent = null;
|
||||
ChartOrientation mOrientation = ChartOrientation.Vertical;
|
||||
bool mIsSubDivision = false;
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
ChartCommon.CleanMesh(null, ref mCleanMesh);
|
||||
ChartCommon.SafeDestroy(mDispose);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// fix the labels after the axis data is updated
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
partial void InnerFixLabels(AnyChart parent)
|
||||
{
|
||||
if (mAxis == null)
|
||||
return;
|
||||
if(((ChartMainDivisionInfo) mAxis.MainDivisions).Messure == ChartDivisionInfo.DivisionMessure.DataUnits)
|
||||
{
|
||||
SetAxis(mScroll, mParent, mAxis, mOrientation, mIsSubDivision);
|
||||
return;
|
||||
}
|
||||
for(int i=0; i<mTexts.Count; i++)
|
||||
{
|
||||
BillboardText text = mTexts[i];
|
||||
double min = ((IInternalUse)parent).InternalMinValue(mAxis);
|
||||
double max = ((IInternalUse)parent).InternalMaxValue(mAxis);
|
||||
if (text.UserData is AxisBase.TextData)
|
||||
{
|
||||
AxisBase.TextData data = (AxisBase.TextData)text.UserData;
|
||||
double newVal = min * (1.0 - (double)data.interp) + max * (double)data.interp;
|
||||
string toSet = "";
|
||||
if (mAxis.Format == AxisFormat.Number)
|
||||
toSet = ChartAdancedSettings.Instance.FormatFractionDigits(data.fractionDigits, (float)newVal,parent.CustomNumberFormat);
|
||||
else
|
||||
{
|
||||
DateTime date = ChartDateUtility.ValueToDate(newVal);
|
||||
if (mAxis.Format == AxisFormat.DateTime)
|
||||
toSet = ChartDateUtility.DateToDateTimeString(date,mParent.CustomDateTimeFormat);
|
||||
else
|
||||
{
|
||||
if (mAxis.Format == AxisFormat.Date)
|
||||
toSet = ChartDateUtility.DateToDateString(date);
|
||||
else
|
||||
toSet = ChartDateUtility.DateToTimeString(date);
|
||||
}
|
||||
|
||||
}
|
||||
toSet = data.info.TextPrefix + toSet + data.info.TextSuffix;
|
||||
ChartCommon.UpdateTextParams(text.UIText, toSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// used internally to get the tiling for a chart axis division
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="orientation"></param>
|
||||
/// <param name="inf"></param>
|
||||
/// <returns></returns>
|
||||
float GetTiling(AnyChart parent, ChartOrientation orientation, ChartDivisionInfo inf)
|
||||
{
|
||||
MaterialTiling tiling = inf.MaterialTiling;
|
||||
if (tiling.EnableTiling == false || tiling.TileFactor <= 0f)
|
||||
return 1f;
|
||||
float length = Math.Abs(ChartCommon.GetAutoLength(parent, orientation, inf));
|
||||
float backLength = ChartCommon.GetAutoLength(parent, orientation);
|
||||
float depth = ChartCommon.GetAutoDepth(parent, orientation, inf);
|
||||
if (inf.MarkBackLength.Automatic == false)
|
||||
backLength = inf.MarkBackLength.Value;
|
||||
if (backLength != 0 && depth > 0)
|
||||
length += Math.Abs(backLength) + Math.Abs(depth);
|
||||
return length / tiling.TileFactor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// sets the axis settings. Calling this method will cause the axisgenerator to create the axis mesh
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
/// <param name="axis"></param>
|
||||
/// <param name="axisOrientation"></param>
|
||||
/// <param name="isSubDivisions"></param>
|
||||
partial void InnerSetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, bool isSubDivisions)
|
||||
{
|
||||
mScroll = scrollOffset;
|
||||
mParent = parent;
|
||||
mAxis = axis;
|
||||
mOrientation = axisOrientation;
|
||||
mIsSubDivision = isSubDivisions;
|
||||
if (mMesh == null)
|
||||
{
|
||||
mMesh = new WorldSpaceChartMesh(2);
|
||||
mMesh.RecycleText = true;
|
||||
}
|
||||
|
||||
mMesh.Clear();
|
||||
mMesh.Orientation = axisOrientation;
|
||||
mAxis = axis;
|
||||
|
||||
if (isSubDivisions)
|
||||
axis.AddSubdivisionToChartMesh(scrollOffset,parent, transform, mMesh, axisOrientation);
|
||||
else
|
||||
axis.AddMainDivisionToChartMesh(scrollOffset,parent, transform, mMesh, axisOrientation);
|
||||
|
||||
if (mMesh.TextObjects != null)
|
||||
{
|
||||
foreach (BillboardText text in mMesh.TextObjects)
|
||||
{
|
||||
((IInternalUse)parent).InternalTextController.AddText(text);
|
||||
}
|
||||
}
|
||||
mTexts = mMesh.CurrentTextObjects;
|
||||
|
||||
Mesh newMesh = mMesh.Generate(mCreated);
|
||||
mCreated = newMesh;
|
||||
newMesh.hideFlags = HideFlags.DontSave;
|
||||
if (mFilter == null)
|
||||
mFilter = GetComponent<MeshFilter>();
|
||||
mFilter.sharedMesh = newMesh;
|
||||
MeshCollider collider = GetComponent<MeshCollider>();
|
||||
if (collider != null)
|
||||
collider.sharedMesh = newMesh;
|
||||
ChartCommon.CleanMesh(newMesh, ref mCleanMesh);
|
||||
|
||||
MeshRenderer renderer = GetComponent<MeshRenderer>();
|
||||
if(renderer != null)
|
||||
{
|
||||
Material m = mAxis.MainDivisions.Material;
|
||||
float tiling = GetTiling(parent, axisOrientation, mAxis.MainDivisions);
|
||||
if (isSubDivisions)
|
||||
{
|
||||
m = mAxis.SubDivisions.Material;
|
||||
tiling = GetTiling(parent, axisOrientation, mAxis.SubDivisions) ;
|
||||
}
|
||||
mMaterial = m;
|
||||
if (m != null)
|
||||
{
|
||||
ChartCommon.SafeDestroy(mDispose);
|
||||
mDispose = new Material(m);
|
||||
mDispose.hideFlags = HideFlags.DontSave;
|
||||
renderer.sharedMaterial = mDispose;
|
||||
mTiling = tiling;
|
||||
if (mDispose.HasProperty("_ChartTiling"))
|
||||
mDispose.SetFloat("_ChartTiling", mTiling);
|
||||
}
|
||||
}
|
||||
mMesh.DestoryRecycled();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (mMaterial != null && mDispose != null && mDispose.HasProperty("_ChartTiling"))
|
||||
{
|
||||
if (mDispose != mMaterial)
|
||||
mDispose.CopyPropertiesFromMaterial(mMaterial);
|
||||
mDispose.SetFloat("_ChartTiling", mTiling);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2bfad3f1e4ea9a644bbd41612e6342ef
|
||||
timeCreated: 1472984373
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,227 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ChartAndGraph.Axis
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates an axis mesh for a canvas chart
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(CanvasRenderer))]
|
||||
[ExecuteInEditMode]
|
||||
class CanvasAxisGenerator : Image, IAxisGenerator
|
||||
{
|
||||
MeshRenderer mRenderer;
|
||||
MeshFilter mFilter;
|
||||
Mesh mCleanMesh;
|
||||
List<BillboardText> mTexts;
|
||||
AxisBase mAxis;
|
||||
AnyChart mParent;
|
||||
ChartOrientation mOrientation;
|
||||
bool mIsSubDivisions;
|
||||
Material mDispose = null;
|
||||
Material mMaterial;
|
||||
CanvasChartMesh mMesh = null;
|
||||
float mTiling = 1f;
|
||||
double mScrollOffset;
|
||||
#if (!UNITY_5_2_0) && (!UNITY_5_2_1)
|
||||
protected override void OnPopulateMesh(VertexHelper vh)
|
||||
{
|
||||
base.OnPopulateMesh(vh);
|
||||
vh.Clear();
|
||||
if (mAxis == null || mParent == null)
|
||||
return;
|
||||
CanvasChartMesh mesh = new CanvasChartMesh(vh);
|
||||
AddToCanvasChartMesh(mesh);
|
||||
}
|
||||
#endif
|
||||
|
||||
private void AddToCanvasChartMesh(CanvasChartMesh mesh)
|
||||
{
|
||||
mesh.Orientation = mOrientation;
|
||||
if (mIsSubDivisions)
|
||||
mAxis.AddSubdivisionToChartMesh(mScrollOffset,mParent, transform, mesh, mOrientation);
|
||||
else
|
||||
mAxis.AddMainDivisionToChartMesh(mScrollOffset,mParent, transform, mesh, mOrientation);
|
||||
}
|
||||
|
||||
#pragma warning disable 0672
|
||||
|
||||
protected override void OnPopulateMesh(Mesh m)
|
||||
{
|
||||
m.Clear();
|
||||
if (mAxis == null || mParent == null)
|
||||
return;
|
||||
WorldSpaceChartMesh mesh = new WorldSpaceChartMesh(true);
|
||||
mesh.Orientation = mOrientation;
|
||||
if(mIsSubDivisions)
|
||||
mAxis.AddMainDivisionToChartMesh(mScrollOffset,mParent, transform, mesh, mOrientation);
|
||||
else
|
||||
mAxis.AddSubdivisionToChartMesh(mScrollOffset,mParent, transform, mesh, mOrientation);
|
||||
mesh.ApplyToMesh(m);
|
||||
}
|
||||
#pragma warning restore 0672
|
||||
|
||||
public void FixLabels(AnyChart parent)
|
||||
{
|
||||
if (mAxis == null)
|
||||
return;
|
||||
if (((ChartMainDivisionInfo)mAxis.MainDivisions).Messure == ChartDivisionInfo.DivisionMessure.DataUnits)
|
||||
{
|
||||
SetAxis(mScrollOffset, mParent, mAxis, mOrientation, mIsSubDivisions);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < mTexts.Count; i++)
|
||||
{
|
||||
BillboardText text = mTexts[i];
|
||||
double min = ((IInternalUse)parent).InternalMinValue(mAxis);
|
||||
double max = ((IInternalUse)parent).InternalMaxValue(mAxis);
|
||||
if (text.UserData is AxisBase.TextData)
|
||||
{
|
||||
AxisBase.TextData data = (AxisBase.TextData)text.UserData;
|
||||
double newVal = min * (1.0 - (double)data.interp) + max * (double)data.interp;
|
||||
string toSet = "";
|
||||
if (mAxis.Format == AxisFormat.Number)
|
||||
toSet = ChartAdancedSettings.Instance.FormatFractionDigits(data.fractionDigits, (float)newVal,parent.CustomNumberFormat);
|
||||
else
|
||||
{
|
||||
DateTime date = ChartDateUtility.ValueToDate(newVal);
|
||||
if (mAxis.Format == AxisFormat.DateTime)
|
||||
toSet = ChartDateUtility.DateToDateTimeString(date,parent.CustomDateTimeFormat);
|
||||
else
|
||||
{
|
||||
if (mAxis.Format == AxisFormat.Date)
|
||||
toSet = ChartDateUtility.DateToDateString(date);
|
||||
else
|
||||
toSet = ChartDateUtility.DateToTimeString(date);
|
||||
}
|
||||
|
||||
}
|
||||
toSet = data.info.TextPrefix + toSet + data.info.TextSuffix;
|
||||
ChartCommon.UpdateTextParams(text.UIText, toSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateMaterial()
|
||||
{
|
||||
base.UpdateMaterial();
|
||||
if (material == null)
|
||||
return;
|
||||
if (material.mainTexture != null)
|
||||
canvasRenderer.SetTexture(material.mainTexture);
|
||||
canvasRenderer.SetColor(Color.white);
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
if (mDispose != null)
|
||||
ChartCommon.SafeDestroy(mDispose);
|
||||
}
|
||||
|
||||
float GetTiling(MaterialTiling tiling)
|
||||
{
|
||||
if (tiling.EnableTiling == false || tiling.TileFactor <= 0f)
|
||||
return 1f;
|
||||
ChartDivisionInfo inf = mAxis.MainDivisions;
|
||||
if (mIsSubDivisions)
|
||||
inf = mAxis.SubDivisions;
|
||||
float length = ChartCommon.GetAutoLength(mParent, mOrientation, inf);
|
||||
return length / tiling.TileFactor;
|
||||
}
|
||||
|
||||
public void SetAxis(double scrollOffset,AnyChart parent, AxisBase axis, ChartOrientation axisOrientation,bool isSubDivisions)
|
||||
{
|
||||
mScrollOffset = scrollOffset;
|
||||
raycastTarget = false;
|
||||
color = Color.white;
|
||||
mAxis = axis;
|
||||
mParent = parent;
|
||||
mIsSubDivisions = isSubDivisions;
|
||||
mOrientation = axisOrientation;
|
||||
|
||||
if (mMesh == null)
|
||||
{
|
||||
mMesh = new CanvasChartMesh(true);
|
||||
mMesh.RecycleText = true;
|
||||
}
|
||||
mMesh.Clear();
|
||||
|
||||
if (isSubDivisions)
|
||||
mAxis.AddMainDivisionToChartMesh(mScrollOffset,mParent, transform, mMesh, mOrientation);
|
||||
else
|
||||
mAxis.AddSubdivisionToChartMesh(mScrollOffset,mParent, transform, mMesh, mOrientation);
|
||||
|
||||
mTexts = mMesh.CurrentTextObjects;
|
||||
if (mMesh.TextObjects != null)
|
||||
{
|
||||
foreach (BillboardText text in mMesh.TextObjects)
|
||||
{
|
||||
((IInternalUse)parent).InternalTextController.AddText(text);
|
||||
}
|
||||
}
|
||||
|
||||
canvasRenderer.materialCount = 1;
|
||||
if (mDispose != null)
|
||||
ChartCommon.SafeDestroy(mDispose);
|
||||
|
||||
float tiling = 1f;
|
||||
if (!isSubDivisions)
|
||||
{
|
||||
if (axis.SubDivisions.Material != null)
|
||||
{
|
||||
mMaterial = axis.SubDivisions.Material;
|
||||
mDispose = new Material(mMaterial);
|
||||
mDispose.hideFlags = HideFlags.DontSave;
|
||||
material = mDispose;
|
||||
tiling = GetTiling(axis.SubDivisions.MaterialTiling);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (axis.MainDivisions.Material != null)
|
||||
{
|
||||
mMaterial = axis.MainDivisions.Material;
|
||||
mDispose = new Material(mMaterial);
|
||||
mDispose.hideFlags = HideFlags.DontSave;
|
||||
material = mDispose;
|
||||
tiling = GetTiling(axis.MainDivisions.MaterialTiling);
|
||||
}
|
||||
}
|
||||
mTiling = tiling;
|
||||
if(mDispose != null)
|
||||
{
|
||||
if (mDispose.HasProperty("_ChartTiling"))
|
||||
mDispose.SetFloat("_ChartTiling", tiling);
|
||||
}
|
||||
SetAllDirty();
|
||||
Rebuild(CanvasUpdate.PreRender);
|
||||
mMesh.DestoryRecycled();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
if (mMaterial != null && mDispose != null && mDispose.HasProperty("_ChartTiling"))
|
||||
{
|
||||
if (mDispose != mMaterial)
|
||||
mDispose.CopyPropertiesFromMaterial(mMaterial);
|
||||
mDispose.SetFloat("_ChartTiling", mTiling);
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject GetGameObject()
|
||||
{
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
public UnityEngine.Object This()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d05bb511ff55104f930cb9d1c27c8d7
|
||||
timeCreated: 1478793256
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,423 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// holds settings for an axis division.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ChartDivisionInfo : IInternalSettings
|
||||
{
|
||||
public enum DivisionMessure
|
||||
{
|
||||
TotalDivisions,
|
||||
DataUnits
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// validates all properties of this instance. (check if they have correct values)
|
||||
/// </summary>
|
||||
public void ValidateProperites()
|
||||
{
|
||||
if (total < 0)
|
||||
total = 0;
|
||||
fontSharpness = Mathf.Clamp(fontSharpness, 1f, 3f);
|
||||
fontSize = Mathf.Max(fontSize, 0);
|
||||
fractionDigits = Mathf.Clamp(fractionDigits, 0, 7);
|
||||
markThickness = Mathf.Max(markThickness, 0f);
|
||||
materialTiling.TileFactor = Mathf.Max(materialTiling.TileFactor, 0f);
|
||||
textPrefix = (textPrefix == null) ? "" : textPrefix;
|
||||
textSuffix = (textSuffix == null) ? "" : textSuffix;
|
||||
}
|
||||
|
||||
protected virtual float ValidateTotal(float total)
|
||||
{
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// total division lines
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Canvas, NonCanvas]
|
||||
[Tooltip("messure used to create divisions")]
|
||||
protected DivisionMessure messure = DivisionMessure.TotalDivisions;
|
||||
|
||||
/// <summary>
|
||||
/// data units per each division in the chart
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Canvas, NonCanvas]
|
||||
[Tooltip("data units per division")]
|
||||
protected float unitsPerDivision;
|
||||
|
||||
/// <summary>
|
||||
/// total division lines
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Canvas, NonCanvas]
|
||||
[Tooltip("total division lines")]
|
||||
private int total = 3;
|
||||
|
||||
/// <summary>
|
||||
/// total division lines
|
||||
/// </summary>
|
||||
public int Total
|
||||
{
|
||||
get { return total; }
|
||||
set
|
||||
{
|
||||
total = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Material for the line of the division
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Canvas, NonCanvas]
|
||||
[Tooltip("Material for the line of the division")]
|
||||
private Material material;
|
||||
|
||||
/// <summary>
|
||||
/// Material for the division lines
|
||||
/// </summary>
|
||||
public Material Material
|
||||
{
|
||||
get { return material; }
|
||||
set
|
||||
{
|
||||
material = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Material tiling for the division lines. Use this to strech or tile the material along the line
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Canvas, NonCanvas]
|
||||
[Tooltip("Material tiling for the division lines. Use this to strech or tile the material along the line")]
|
||||
private MaterialTiling materialTiling = new MaterialTiling(false, 100f);
|
||||
|
||||
/// <summary>
|
||||
/// Material tiling for the division lines. Use this to strech or tile the material along the line
|
||||
/// </summary>
|
||||
public MaterialTiling MaterialTiling
|
||||
{
|
||||
get {return materialTiling;}
|
||||
set
|
||||
{
|
||||
materialTiling = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The length of the far side of the division lines. This is used only by 3d chart when MarkDepth >0
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Simple, NonCanvas]
|
||||
[Tooltip("The length of the far side of the division lines. This is used only by 3d chart when MarkDepth >0")]
|
||||
private AutoFloat markBackLength = new AutoFloat(true, 0.5f);
|
||||
/// <summary>
|
||||
/// The length of the far side of the division lines. This is used only by 3d charts when MarkDepth >0
|
||||
/// </summary>
|
||||
public AutoFloat MarkBackLength
|
||||
{
|
||||
get { return markBackLength; }
|
||||
set
|
||||
{
|
||||
markBackLength = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The length of the the division lines.
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Simple, Canvas, NonCanvas]
|
||||
[Tooltip("The length of the the division lines.")]
|
||||
private AutoFloat markLength = new AutoFloat(true,0.5f);
|
||||
/// <summary>
|
||||
/// The length of the the division lines.
|
||||
/// </summary>
|
||||
public AutoFloat MarkLength
|
||||
{
|
||||
get { return markLength; }
|
||||
set
|
||||
{
|
||||
markLength = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the depth of the division line. This is used by 3d charts only
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Simple, NonCanvas]
|
||||
private AutoFloat markDepth = new AutoFloat(true,0.5f);
|
||||
public AutoFloat MarkDepth
|
||||
{
|
||||
get { return markDepth; }
|
||||
set
|
||||
{
|
||||
markDepth = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the thickness of the division lines
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Simple, Canvas, NonCanvas]
|
||||
[Tooltip("the thickness of the division lines")]
|
||||
private float markThickness = 0.1f;
|
||||
|
||||
/// <summary>
|
||||
/// the thickness of the division lines
|
||||
/// </summary>
|
||||
public float MarkThickness
|
||||
{
|
||||
get { return markThickness; }
|
||||
set
|
||||
{
|
||||
markThickness = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A prefab for the division labels
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Simple,Canvas, NonCanvas]
|
||||
[Tooltip("A prefab for the division labels")]
|
||||
private MonoBehaviour textPrefab;
|
||||
/// <summary>
|
||||
/// A prefab for the division labels
|
||||
/// </summary>
|
||||
public MonoBehaviour TextPrefab
|
||||
{
|
||||
get { return textPrefab; }
|
||||
set
|
||||
{
|
||||
textPrefab = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// prefix for the axis labels
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Simple,Canvas,NonCanvas]
|
||||
[Tooltip("prefix for the axis labels")]
|
||||
private string textPrefix;
|
||||
|
||||
/// <summary>
|
||||
/// prefix for the axis labels
|
||||
/// </summary>
|
||||
public string TextPrefix
|
||||
{
|
||||
get { return textPrefix; }
|
||||
set
|
||||
{
|
||||
textPrefix = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// suffix for the axis labels
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
[Simple, Canvas, NonCanvas]
|
||||
[Tooltip("suffix for the axis labels")]
|
||||
private string textSuffix;
|
||||
/// <summary>
|
||||
/// suffix for the axis labels
|
||||
/// </summary>
|
||||
public string TextSuffix
|
||||
{
|
||||
get { return textSuffix; }
|
||||
set
|
||||
{
|
||||
textSuffix = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the number of fraction digits in the division labels.
|
||||
/// </summary>
|
||||
[Range(0,7)]
|
||||
[Simple, Canvas, NonCanvas]
|
||||
[SerializeField]
|
||||
[Tooltip("the number of fraction digits in text labels")]
|
||||
private int fractionDigits = 2;
|
||||
/// <summary>
|
||||
/// the number of fraction digits in text labels.
|
||||
/// </summary>
|
||||
public int FractionDigits
|
||||
{
|
||||
get { return fractionDigits; }
|
||||
set
|
||||
{
|
||||
fractionDigits = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Label font size
|
||||
/// </summary>
|
||||
[Simple,Canvas, NonCanvas]
|
||||
[SerializeField]
|
||||
[Tooltip("Label font size")]
|
||||
private int fontSize = 12;
|
||||
/// <summary>
|
||||
/// Label font size
|
||||
/// </summary>
|
||||
public int FontSize
|
||||
{
|
||||
get { return fontSize; }
|
||||
set
|
||||
{
|
||||
fontSize = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// makes the labels sharper if they are blurry
|
||||
/// </summary>
|
||||
[Range(1f,3f)]
|
||||
[Simple, Canvas, NonCanvas]
|
||||
[Tooltip("makes the labels sharper if they are blurry")]
|
||||
[SerializeField]
|
||||
private float fontSharpness = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// makes the labels sharper if they are blurry
|
||||
/// </summary>
|
||||
public float FontSharpness
|
||||
{
|
||||
get { return fontSharpness; }
|
||||
set
|
||||
{
|
||||
fontSharpness = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// depth seperation the division lables. used by 3d charts only
|
||||
/// </summary>
|
||||
[Simple, NonCanvas]
|
||||
[SerializeField]
|
||||
[Tooltip("depth seperation the division lables")]
|
||||
private float textDepth;
|
||||
|
||||
/// <summary>
|
||||
/// depth seperation the division lables.used by 3d charts only
|
||||
/// </summary>
|
||||
public float TextDepth
|
||||
{
|
||||
get { return textDepth; }
|
||||
set
|
||||
{
|
||||
textDepth = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// breadth seperation for the division labels
|
||||
/// </summary>
|
||||
[Simple, Canvas,NonCanvas]
|
||||
[SerializeField]
|
||||
[Tooltip("breadth seperation for the division labels")]
|
||||
private float textSeperation;
|
||||
|
||||
/// <summary>
|
||||
/// breadth seperation for the division labels
|
||||
/// </summary>
|
||||
public float TextSeperation
|
||||
{
|
||||
get { return textSeperation; }
|
||||
set
|
||||
{
|
||||
textSeperation = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Alignment of the division lables
|
||||
/// </summary>
|
||||
[Simple, Canvas, NonCanvas]
|
||||
[SerializeField]
|
||||
[Tooltip("Alignment of the division lables")]
|
||||
private ChartDivisionAligment alignment = ChartDivisionAligment.Standard;
|
||||
|
||||
/// <summary>
|
||||
/// Alignment of the division lables
|
||||
/// </summary>
|
||||
public ChartDivisionAligment Alignment
|
||||
{
|
||||
get { return alignment; }
|
||||
set
|
||||
{
|
||||
alignment = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable 0067
|
||||
private event EventHandler OnDataUpdate;
|
||||
#pragma warning restore 0067
|
||||
private event EventHandler OnDataChanged;
|
||||
|
||||
protected virtual void RaiseOnChanged()
|
||||
{
|
||||
if (OnDataChanged != null)
|
||||
OnDataChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#region Intenal Use
|
||||
event EventHandler IInternalSettings.InternalOnDataUpdate
|
||||
{
|
||||
add
|
||||
{
|
||||
OnDataUpdate += value;
|
||||
}
|
||||
|
||||
remove
|
||||
{
|
||||
OnDataUpdate -= value;
|
||||
}
|
||||
}
|
||||
|
||||
event EventHandler IInternalSettings.InternalOnDataChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
OnDataChanged += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
OnDataChanged -= value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 359f85bed13b139458429a9181677dc1
|
||||
timeCreated: 1478832101
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using ChartAndGraph;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
[Serializable]
|
||||
public class ChartMainDivisionInfo : ChartDivisionInfo
|
||||
{
|
||||
public DivisionMessure Messure
|
||||
{
|
||||
get { return messure; }
|
||||
set
|
||||
{
|
||||
messure = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public float UnitsPerDivision
|
||||
{
|
||||
get { return unitsPerDivision; }
|
||||
set
|
||||
{
|
||||
unitsPerDivision = value;
|
||||
RaiseOnChanged();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9deba227f79698e41bdd30467581bec3
|
||||
timeCreated: 1497092384
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// holds settings for an axis division.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
class ChartSubDivisionInfo : ChartDivisionInfo
|
||||
{
|
||||
protected override float ValidateTotal(float total)
|
||||
{
|
||||
return Mathf.Round(total);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b560179d771be94991a4686a1e7fc94
|
||||
timeCreated: 1496763003
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// defines a horizontal axis for the chart componenet attached to the same object
|
||||
/// </summary>
|
||||
public class HorizontalAxis : AxisBase
|
||||
{
|
||||
protected override Action<IInternalUse, bool> Assign
|
||||
{
|
||||
get
|
||||
{
|
||||
return (x, clear) =>
|
||||
{
|
||||
if (clear)
|
||||
{
|
||||
if (x.HorizontalAxis == this)
|
||||
x.HorizontalAxis = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x.HorizontalAxis != this)
|
||||
x.HorizontalAxis = this;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08395b16192f9114e8ad4953e48f90bd
|
||||
timeCreated: 1479132481
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ChartAndGraph.Axis
|
||||
{
|
||||
/// <summary>
|
||||
/// Axis generator functionallity that is not dependant on the diminetion of the chart
|
||||
/// </summary>
|
||||
public interface IAxisGenerator
|
||||
{
|
||||
UnityEngine.Object This();
|
||||
GameObject GetGameObject();
|
||||
void FixLabels(AnyChart parent);
|
||||
void SetAxis(double scrollOffset,AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, bool isSubDivisions);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be5483351106eff4e872930ec406b3ea
|
||||
timeCreated: 1478793461
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,34 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ChartAndGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// defines a vertical axis for the chart componenet attached to the same object
|
||||
/// </summary>
|
||||
public class VerticalAxis : AxisBase
|
||||
{
|
||||
protected override Action<IInternalUse, bool> Assign
|
||||
{
|
||||
get
|
||||
{
|
||||
return (x, clear) =>
|
||||
{
|
||||
if (clear)
|
||||
{
|
||||
if (x.VerticalAxis == this)
|
||||
x.VerticalAxis = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x.VerticalAxis != this)
|
||||
x.VerticalAxis = this;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7598682dc3bb9174d9546fe226cab95a
|
||||
timeCreated: 1479132481
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user