提交日志-20240627-1235

1、更新了XChart插件版本
2、更新了漫游路径绘制工具
3、扩大了小地图缩放范围
4、更新了重量单位,kg2ton
5、其他UI更新优化
This commit is contained in:
AFeiJia 2024-06-27 12:35:44 +08:00
parent f3fe5787eb
commit e0fd887014
122 changed files with 32871 additions and 929 deletions

View File

@ -0,0 +1,123 @@
fileFormatVersion: 2
guid: 651fe001e96774440ad9f4682e9ecaa2
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,123 @@
fileFormatVersion: 2
guid: 14dcdc8f51ea8cb4db8acf34b24e06cf
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -90,7 +90,8 @@ public class MiniMapManagerEditor : Editor
SerializedProperty FullScreenMiniMapOrthographicSize;
SerializedProperty DragSpeed;
SerializedProperty ZoomSpeed;
SerializedProperty OrthographicSizeClamp;
//SerializedProperty OrthographicSizeClamp;
SerializedProperty MinOrthographicSize;
bool use_chinese;
@ -107,7 +108,8 @@ public class MiniMapManagerEditor : Editor
DragSpeed = serializedObject.FindProperty("DragSpeed");
ZoomSpeed = serializedObject.FindProperty("ZoomSpeed");
OrthographicSizeClamp = serializedObject.FindProperty("OrthographicSizeClamp");
//OrthographicSizeClamp = serializedObject.FindProperty("OrthographicSizeClamp");
MinOrthographicSize = serializedObject.FindProperty("MinOrthographicSize");
}
public override void OnInspectorGUI()
@ -131,7 +133,8 @@ public class MiniMapManagerEditor : Editor
EditorGUILayout.PropertyField(FullScreenMiniMapOrthographicSize, new GUIContent(use_chinese ? "小地图相机可视全地图时的正交尺寸大小" : FullScreenMiniMapOrthographicSize.name));
EditorGUILayout.PropertyField(DragSpeed, new GUIContent(use_chinese ? "小地图拖拽速度" : DragSpeed.name));
EditorGUILayout.PropertyField(ZoomSpeed, new GUIContent(use_chinese ? "小地图缩放速度" : ZoomSpeed.name));
EditorGUILayout.PropertyField(OrthographicSizeClamp, new GUIContent(use_chinese ? "苤華芞坫溫癹秶毓峓" : OrthographicSizeClamp.name));
//EditorGUILayout.PropertyField(OrthographicSizeClamp, new GUIContent(use_chinese ? "苤華芞坫溫癹秶毓峓" : OrthographicSizeClamp.name));
EditorGUILayout.PropertyField(MinOrthographicSize, new GUIContent(use_chinese ? "苤華芞坫溫癹秶毓峓" : MinOrthographicSize.name));
serializedObject.ApplyModifiedProperties();

View File

@ -52,7 +52,8 @@ public class MiniMap : MonoBehaviour, IPointerDownHandler, IPointerMoveHandler,
public void OnScroll(PointerEventData eventData)
{
m_MiniMapManager.MiniCamera.orthographicSize -= eventData.scrollDelta.y * m_MiniMapManager.ZoomSpeed;
m_MiniMapManager.MiniCamera.orthographicSize = Mathf.Clamp(m_MiniMapManager.MiniCamera.orthographicSize, m_MiniMapManager.OrthographicSizeClamp.x, m_MiniMapManager.OrthographicSizeClamp.y);
//m_MiniMapManager.MiniCamera.orthographicSize = Mathf.Clamp(m_MiniMapManager.MiniCamera.orthographicSize, m_MiniMapManager.OrthographicSizeClamp.x, m_MiniMapManager.OrthographicSizeClamp.y);
m_MiniMapManager.MiniCamera.orthographicSize = Mathf.Clamp(m_MiniMapManager.MiniCamera.orthographicSize, m_MiniMapManager.MinOrthographicSize, m_MiniMapManager.FullScreenMiniMapOrthographicSize);
var clamp_value = m_MiniMapManager.MiniCamera.orthographicSize - m_MiniMapManager.FullScreenMiniMapOrthographicSize;

View File

@ -74,7 +74,8 @@ public class MiniMapManager : MonoBehaviour
/// 缩放尺寸限制
/// 最小值应大于0
/// </summary>
public Vector2 OrthographicSizeClamp = new Vector2(5, 15);
//public Vector2 OrthographicSizeClamp = new Vector2(5, 15);
public float MinOrthographicSize = 20;
// Start is called before the first frame update
void Start()
{

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fccc42fffe40bd64a9444a4eb7020da8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,61 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace W.Bezier.Editor
{
/// <summary>
///
/// </summary>
[CustomEditor(typeof(BezierDrawer))]
public class BezierDrawerEditor : UnityEditor.Editor
{
bool use_chinese;
BezierDrawer m_BezierDrawer;
SerializedProperty DrawAuxiliaryLine;
SerializedProperty AuxiliaryLineColor;
SerializedProperty DrawBezierCurve;
SerializedProperty BezierCurveColor;
SerializedProperty accuracy;
SerializedProperty UseCurvePath;
private void OnEnable()
{
m_BezierDrawer = (BezierDrawer)target;
DrawAuxiliaryLine = serializedObject.FindProperty("DrawAuxiliaryLine");
AuxiliaryLineColor = serializedObject.FindProperty("AuxiliaryLineColor");
DrawBezierCurve = serializedObject.FindProperty("DrawBezierCurve");
BezierCurveColor = serializedObject.FindProperty("BezierCurveColor");
accuracy = serializedObject.FindProperty("accuracy");
UseCurvePath = serializedObject.FindProperty("UseCurvePath");
}
public override void OnInspectorGUI()
{
//base.OnInspectorGUI();
serializedObject.Update();
use_chinese = EditorGUILayout.Toggle(use_chinese ? "使用中文面板" : "use_chinese", use_chinese);
EditorGUILayout.PropertyField(UseCurvePath, new GUIContent(use_chinese ? "使用曲线作为漫游路径" : UseCurvePath.name));
EditorGUILayout.PropertyField(DrawAuxiliaryLine, new GUIContent(use_chinese ? "绘画辅助线" : DrawAuxiliaryLine.name));
if (m_BezierDrawer.DrawAuxiliaryLine)
{
EditorGUILayout.PropertyField(AuxiliaryLineColor, new GUIContent(use_chinese ? "辅助线颜色" : AuxiliaryLineColor.name));
}
EditorGUILayout.PropertyField(DrawBezierCurve, new GUIContent(use_chinese ? "绘画贝塞尔曲线" : DrawBezierCurve.name));
if (m_BezierDrawer.DrawBezierCurve)
{
m_BezierDrawer.accuracy = EditorGUILayout.IntSlider(use_chinese ? "曲线精度" : "Accuracy", m_BezierDrawer.accuracy, 5, 100);
EditorGUILayout.PropertyField(BezierCurveColor, new GUIContent(use_chinese ? "曲线颜色" : BezierCurveColor.name));
}
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1d778205a63524227a09c7e5b0e8736f
guid: db39b7cc14697174589184783c4900a1
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -117,6 +117,11 @@
贝塞尔曲线颜色
</summary>
</member>
<member name="F:W.Bezier.BezierDrawer.UseCurvePath">
<summary>
是否使用曲线作为路径
</summary>
</member>
<member name="T:W.UI.ManualAttribute">
<summary>
手动标签;请将标签置于首位

View File

@ -5865,7 +5865,7 @@ RectTransform:
- {fileID: 1661560767}
- {fileID: 1991644977}
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 4
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -50654,6 +50654,43 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 00d95f725a9bc4909a37a5325ddc40f8, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1499317508985725535
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1235781488186031588}
m_Layer: 0
m_Name: Sliding Area
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1235781488186031588
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1499317508985725535}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6126500298045710102}
m_Father: {fileID: 3880332578325955988}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2921076089172232507
GameObject:
m_ObjectHideFlags: 0
@ -73837,6 +73874,158 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &3291292101426671456
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1975362788199603019}
- component: {fileID: 2946702711250800147}
- component: {fileID: 4493071503415881721}
m_Layer: 0
m_Name: CutLine (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1975362788199603019
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3291292101426671456}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 275.3, y: 113.9}
m_SizeDelta: {x: 2, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2946702711250800147
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3291292101426671456}
m_CullTransparentMesh: 1
--- !u!114 &4493071503415881721
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3291292101426671456}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 14dcdc8f51ea8cb4db8acf34b24e06cf, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &3373501095640057344
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6126500298045710102}
- component: {fileID: 1984783476333358905}
- component: {fileID: 3894334534370374424}
m_Layer: 0
m_Name: Handle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6126500298045710102
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3373501095640057344}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1235781488186031588}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1984783476333358905
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3373501095640057344}
m_CullTransparentMesh: 1
--- !u!114 &3894334534370374424
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3373501095640057344}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 651fe001e96774440ad9f4682e9ecaa2, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &4429255972565506386
GameObject:
m_ObjectHideFlags: 0
@ -73996,6 +74185,8 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1070533407305697478}
- {fileID: 1975362788199603019}
- {fileID: 4429255973254873009}
- {fileID: 4429255974379458594}
- {fileID: 4429255973181588801}
@ -75507,11 +75698,11 @@ RectTransform:
m_Father: {fileID: 4429255972661881771}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 316.9999, y: -27.999996}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4429255972867189625
CanvasRenderer:
m_ObjectHideFlags: 0
@ -75590,8 +75781,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 42}
m_SizeDelta: {x: 682, y: 34}
m_AnchoredPosition: {x: 9, y: 42}
m_SizeDelta: {x: 702, y: 34}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &4429255972870730853
MonoBehaviour:
@ -76150,11 +76341,11 @@ RectTransform:
m_Father: {fileID: 4429255972867189631}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 2, y: -0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 2, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4429255973001932272
CanvasRenderer:
m_ObjectHideFlags: 0
@ -76190,7 +76381,7 @@ MonoBehaviour:
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
@ -77374,7 +77565,7 @@ RectTransform:
- {fileID: 4429255973244923115}
- {fileID: 4429255973158022117}
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 2
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -77833,7 +78024,7 @@ RectTransform:
- {fileID: 4429255972998966839}
- {fileID: 4429255973222742713}
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 0
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -79847,7 +80038,7 @@ RectTransform:
- {fileID: 4429255972870730873}
- {fileID: 4429255974319980991}
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 3
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -80038,7 +80229,7 @@ RectTransform:
m_Children:
- {fileID: 4429255973584078619}
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 6
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -83363,11 +83554,11 @@ RectTransform:
m_Father: {fileID: 4429255972661881771}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 316.9999, y: -27.999996}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -316.9999, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
m_Pivot: {x: 1, y: 0.5}
--- !u!222 &4429255974035410569
CanvasRenderer:
m_ObjectHideFlags: 0
@ -83439,11 +83630,11 @@ RectTransform:
m_Father: {fileID: 4429255974035410575}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 2, y: -0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -2, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
m_Pivot: {x: 1, y: 0.5}
--- !u!222 &4429255974046030282
CanvasRenderer:
m_ObjectHideFlags: 0
@ -83479,7 +83670,7 @@ MonoBehaviour:
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_Alignment: 5
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
@ -85049,13 +85240,14 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4429255973438302452}
- {fileID: 3880332578325955988}
m_Father: {fileID: 4429255973384953675}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 22}
m_SizeDelta: {x: 682, y: 205}
m_AnchoredPosition: {x: 9, y: 22}
m_SizeDelta: {x: 702, y: 205}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &4429255974319980986
CanvasRenderer:
@ -85117,7 +85309,7 @@ MonoBehaviour:
m_ScrollSensitivity: 50
m_Viewport: {fileID: 4429255973438302452}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 1798131067378635716}
m_HorizontalScrollbarVisibility: 2
m_VerticalScrollbarVisibility: 2
m_HorizontalScrollbarSpacing: -3
@ -85908,7 +86100,7 @@ RectTransform:
m_Children:
- {fileID: 4429255974317406437}
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 1
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -86675,7 +86867,7 @@ RectTransform:
m_Children:
- {fileID: 4429255974229317596}
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 5
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
@ -88199,3 +88391,206 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7557979062855420411
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3880332578325955988}
- component: {fileID: 4557869115599376973}
- component: {fileID: 1731868577530884603}
- component: {fileID: 1798131067378635716}
m_Layer: 0
m_Name: Scrollbar Vertical
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3880332578325955988
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7557979062855420411}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1235781488186031588}
m_Father: {fileID: 4429255974319980991}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 10, y: 0}
m_SizeDelta: {x: 3, y: 0}
m_Pivot: {x: 1, y: 1}
--- !u!222 &4557869115599376973
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7557979062855420411}
m_CullTransparentMesh: 1
--- !u!114 &1731868577530884603
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7557979062855420411}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 14dcdc8f51ea8cb4db8acf34b24e06cf, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &1798131067378635716
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7557979062855420411}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 3894334534370374424}
m_HandleRect: {fileID: 6126500298045710102}
m_Direction: 2
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &8977047954625436353
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1070533407305697478}
- component: {fileID: 2154428258912788217}
- component: {fileID: 7990262197906234112}
m_Layer: 0
m_Name: CutLine
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1070533407305697478
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8977047954625436353}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4429255972613017465}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 9, y: 80}
m_SizeDelta: {x: 700, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2154428258912788217
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8977047954625436353}
m_CullTransparentMesh: 1
--- !u!114 &7990262197906234112
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8977047954625436353}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 1dc6fedf967bf4249a0322eff03fe750, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

View File

@ -553,6 +553,246 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &1958024985448271764
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2161205383703257879}
- component: {fileID: 8607699412368181015}
- component: {fileID: 7187581017899265633}
m_Layer: 0
m_Name: Handle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2161205383703257879
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1958024985448271764}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4409254735685022226}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8607699412368181015
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1958024985448271764}
m_CullTransparentMesh: 1
--- !u!114 &7187581017899265633
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1958024985448271764}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 651fe001e96774440ad9f4682e9ecaa2, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &2851630424632914755
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4409254735685022226}
m_Layer: 0
m_Name: Sliding Area
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4409254735685022226
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2851630424632914755}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2161205383703257879}
m_Father: {fileID: 1399166639746301904}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &4252992305857558929
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1399166639746301904}
- component: {fileID: 6447911896157005946}
- component: {fileID: 4930888605104437101}
- component: {fileID: 3717310468637938653}
m_Layer: 0
m_Name: Scrollbar Vertical
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1399166639746301904
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4252992305857558929}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4409254735685022226}
m_Father: {fileID: 8743207625355349580}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 20, y: 0}
m_SizeDelta: {x: 3, y: 0}
m_Pivot: {x: 1, y: 1}
--- !u!222 &6447911896157005946
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4252992305857558929}
m_CullTransparentMesh: 1
--- !u!114 &4930888605104437101
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4252992305857558929}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 14dcdc8f51ea8cb4db8acf34b24e06cf, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &3717310468637938653
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4252992305857558929}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 7187581017899265633}
m_HandleRect: {fileID: 2161205383703257879}
m_Direction: 2
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &7077179393787099829
GameObject:
m_ObjectHideFlags: 0
@ -782,13 +1022,14 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8743207627178484732}
- {fileID: 1399166639746301904}
m_Father: {fileID: 8743207625565546792}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: -63}
m_SizeDelta: {x: -64, y: 471.1738}
m_AnchoredPosition: {x: 0, y: -52.413086}
m_SizeDelta: {x: -64, y: 450}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8743207625355349583
CanvasRenderer:
@ -850,7 +1091,7 @@ MonoBehaviour:
m_ScrollSensitivity: 50
m_Viewport: {fileID: 8743207627178484732}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 3717310468637938653}
m_HorizontalScrollbarVisibility: 2
m_VerticalScrollbarVisibility: 2
m_HorizontalScrollbarSpacing: -3
@ -2779,9 +3020,9 @@ RectTransform:
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: -22}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!222 &8743207627178484735
CanvasRenderer:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 08f571edde4b15e44b9fc4a447027008
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -28,6 +28,10 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
/// 贝塞尔曲线基准坐标集合
/// </summary>
public Vector3[] m_RoamingPoints;
/// <summary>
/// »ù×¼Ïß·¾¶³¤¶È
/// </summary>
public float RoamingPathLength;
/// <summary>
/// 漫游协程
@ -92,6 +96,15 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
{
m_RoamingPoints[i] = m_RoamingAnchors[i].Position;
}
RoamingPathLength = 0;
for (int i = 0; i < m_RoamingPoints.Length; i++)
{
if (i + 1 < m_RoamingPoints.Length)
{
RoamingPathLength += Vector3.Distance(m_RoamingPoints[i], m_RoamingPoints[i + 1]);
}
}
}
[Range(0, 1)]
public float look = 0;
@ -119,13 +132,23 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
}
//重新开始漫游
if (BezierCurve == null)
if (BezierDrawer.UseCurvePath)
{
BezierCurve = new BezierCurve(m_RoamingPoints, BezierDrawer != null ? BezierDrawer.accuracy : 10);
if (BezierCurve == null)
{
BezierCurve = new BezierCurve(m_RoamingPoints, BezierDrawer != null ? BezierDrawer.accuracy : 10);
}
TargetCamera.position = BezierCurve.CurvePoints[0];
TargetCamera.LookAt(BezierCurve.CurvePoints[1]);
m_RoamingTween = TargetCamera.DOPath(BezierCurve.CurvePoints, BezierCurve.CurveLength / RoamingSpeed).SetEase(Ease.Linear).SetLoops(_looping ? -1 : 0).SetLookAt(look).OnComplete(() => { _roming_finish_callback?.Invoke(); });
}
else
{
TargetCamera.position = m_RoamingPoints[0];
TargetCamera.LookAt(m_RoamingPoints[1]);
m_RoamingTween = TargetCamera.DOPath(m_RoamingPoints, RoamingPathLength / RoamingSpeed).SetEase(Ease.Linear).SetLoops(_looping ? -1 : 0).SetLookAt(look).OnComplete(() => { _roming_finish_callback?.Invoke(); });
}
TargetCamera.position = BezierCurve.CurvePoints[0];
TargetCamera.LookAt(BezierCurve.CurvePoints[1]);
m_RoamingTween = TargetCamera.DOPath(BezierCurve.CurvePoints, BezierCurve.CurveLength / RoamingSpeed).SetEase(Ease.Linear).SetLoops(_looping ? -1 : 0).SetLookAt(look).OnComplete(() => { _roming_finish_callback?.Invoke(); });
}
else

View File

@ -0,0 +1,81 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HelpTool
{
/// <summary>
/// 千克转换为吨
/// </summary>
/// <param name="_origin"></param>
/// <param name="_after"></param>
/// <returns></returns>
public static string Kg2Ton(decimal? _origin)
{
string _res_value;
var _value = float.Parse(_origin.ToString());
var _after = _value / 1000f;
_res_value = _after.ToString("F2")+" T";
return _res_value;
}
/// <summary>
/// 千克转换为吨
/// </summary>
/// <param name="_origin"></param>
/// <param name="_after"></param>
/// <returns></returns>
public static string Kg2Ton(decimal? _origin, out float _after)
{
string _res_value;
var _value = float.Parse(_origin.ToString());
_after = _value / 1000f;
_res_value = _after.ToString();
return _res_value;
}
/// <summary>
/// 千克转换为吨
/// </summary>
/// <param name="_origin"></param>
/// <param name="_after"></param>
/// <returns></returns>
public static string Kg2Ton(string _origin, out float _after)
{
string _res_value;
var _value = float.Parse(_origin);
_after = _value / 1000f;
_res_value = _after.ToString();
return _res_value;
}
/// <summary>
/// 千克转换为吨
/// </summary>
/// <param name="_origin"></param>
/// <param name="_after"></param>
/// <returns></returns>
public static string Kg2Ton(float _origin, out float _after)
{
string _res_value;
_after = _origin / 1000f;
_res_value = _after.ToString();
return _res_value;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 13e6720aecf560d4faba27e0ffc67797
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -46,6 +46,8 @@ public class UIManager : Singleton<UIManager>
UIRoot.Instance.SearchButton.onClick.AddListener(Search);
UIRoot.Instance.ClearSearchButton.onClick.AddListener(ClaerSearch);
UIRoot.Instance.ExitButton.onClick.AddListener(Exit);
ApiManager.Instance.m_OnRtBeltUpdate += RtBeltValueApply;
}
@ -223,6 +225,11 @@ public class UIManager : Singleton<UIManager>
}
}
void Exit()
{
Application.Quit();
}
protected override void OnDestroy()
{
base.OnDestroy();

View File

@ -67,6 +67,10 @@ public class UIRoot : UITool
/// 摄像机视频界面
/// </summary>
public VideoWebPage VideoWebPage;
/// <summary>
/// 退出按钮
/// </summary>
public Button ExitButton;
#endregion
protected override void Awake()

View File

@ -255,42 +255,7 @@ public class MeasuringScale : PanelBase
StartTimePickButton.onClick.AddListener(PickTime);
EndTimePickButton.onClick.AddListener(PickTime);
TimeSearchButton.onClick.AddListener(() =>
{
if (StartTime == default || EndTime == default)
{
Debug.Log("请设置开始和结束时间");
return;
}
var _compare = DateTime.Compare(StartTime, EndTime);
if (_compare == 0 || _compare > 0)
{
Debug.Log("请设置正确的时间范围");
return;
}
//查询时关闭时间选择器
PickTime(false);
for (int i = 0; i < MeasuringScaleItems.Count; i++)
{
Destroy(MeasuringScaleItems[i].gameObject);
}
MeasuringScaleItems.Clear();
StartCoroutine(ApiManager.Instance.PostMeasureScaleHistroyData<T_ALM_PIPECOLLDATACOMPARE>(T_BAS_ELEC_WEIGHTER.PIPE_CODE, StartTime, EndTime, (_T_ALM_PIPECOLLDATACOMPARE_List) =>
{
for (int i = 0; i < _T_ALM_PIPECOLLDATACOMPARE_List.Count; i++)
{
var _item = Instantiate(MeasuringScaleItemPrefab);
_item.transform.parent = MeasuringScaleItemContent;
_item.transform.localScale = Vector3.one;
_item.Init(_T_ALM_PIPECOLLDATACOMPARE_List[i]);
MeasuringScaleItems.Add(_item);
}
}));
});
TimeSearchButton.onClick.AddListener(ApplyHistoryData);
CloseButton.onClick.AddListener(HidePanel);
MeasuringScaleItemPrefab = Resources.Load<MeasuringScaleItem>("Prefabs/UI/MeasuringScaleInfo/MeasuringScaleItem");
@ -307,6 +272,9 @@ public class MeasuringScale : PanelBase
PickTime(false);
}
/// <summary>
/// 选择时间面板启用/关闭
/// </summary>
public void PickTime()
{
PickTime(!ShowTimePicker);
@ -344,22 +312,54 @@ public class MeasuringScale : PanelBase
StartCoroutine(ApiManager.Instance.GetMeasureScaleRealTimeData<T_ALM_PIPECOLLDATA>(_T_BAS_ELEC_WEIGHTER.PIPE_CODE, (_T_ALM_PIPECOLLDATA) =>
{
CollectTime.text = _T_ALM_PIPECOLLDATA.COLL_TIME.ToString();
RealTimeCumulativeQuality.text = float.Parse(_T_ALM_PIPECOLLDATA.STAN_PRESENT_FLOWMETER_TOTAL_QUALITY.ToString()).ToString("F2");
RealTimeCumulativeQuality.text = HelpTool.Kg2Ton(_T_ALM_PIPECOLLDATA.STAN_PRESENT_FLOWMETER_TOTAL_QUALITY);
DOTween.To(() => transform.localScale, _scale => transform.localScale = _scale, Vector3.one, 0.5f);
}));
}
//StartCoroutine(ApiManager.Instance.PostMeasureScaleHistroyData<T_ALM_PIPECOLLDATACOMPARE>(_T_BAS_ELEC_WEIGHTER.PIPE_CODE, StartTime, EndTime, (_T_ALM_PIPECOLLDATACOMPARE_List) =>
//{
// for (int i = 0; i < _T_ALM_PIPECOLLDATACOMPARE_List.Count; i++)
// {
// var _item = Instantiate(MeasuringScaleItemPrefab);
// _item.transform.parent = MeasuringScaleItemContent;
// _item.transform.localScale = Vector3.one;
/// <summary>
/// 历史数据
/// </summary>
void ApplyHistoryData()
{
if (StartTime == default || EndTime == default)
{
Debug.Log("请设置开始和结束时间");
return;
}
var _compare = DateTime.Compare(StartTime, EndTime);
if (_compare == 0 || _compare > 0)
{
Debug.Log("请设置正确的时间范围");
return;
}
// _item.Init(_T_ALM_PIPECOLLDATACOMPARE_List[i]);
// MeasuringScaleItems.Add(_item);
// }
//}));
//查询时关闭时间选择器
PickTime(false);
for (int i = 0; i < MeasuringScaleItems.Count; i++)
{
Destroy(MeasuringScaleItems[i].gameObject);
}
MeasuringScaleItems.Clear();
LineChart.ClearData();
StartCoroutine(ApiManager.Instance.PostMeasureScaleHistroyData<T_ALM_PIPECOLLDATACOMPARE>(T_BAS_ELEC_WEIGHTER.PIPE_CODE, StartTime, EndTime, (_T_ALM_PIPECOLLDATACOMPARE_List) =>
{
for (int i = 0; i < _T_ALM_PIPECOLLDATACOMPARE_List.Count; i++)
{
var _item = Instantiate(MeasuringScaleItemPrefab);
_item.transform.parent = MeasuringScaleItemContent;
_item.transform.localScale = Vector3.one;
_item.Init(_T_ALM_PIPECOLLDATACOMPARE_List[i]);
MeasuringScaleItems.Add(_item);
//LineChart.AddXAxisData()
}
Debug.Log($"时间段【{StartTime}-{EndTime}】历史数据总数:{_T_ALM_PIPECOLLDATACOMPARE_List.Count}");
}));
}
}

View File

@ -18,6 +18,6 @@ public class MeasuringScaleItem : MonoBehaviour
{
MSCode.text = _T_ALM_PIPECOLLDATACOMPARE.PIPE_CODE;
CDTime.text = _T_ALM_PIPECOLLDATACOMPARE.COLL_TIME.ToString();
RealTime.text = float.Parse(_T_ALM_PIPECOLLDATACOMPARE.STAN_PRESENT_FLOWMETER_TOTAL_QUALITY.ToString()).ToString("F2");
RealTime.text = HelpTool.Kg2Ton(_T_ALM_PIPECOLLDATACOMPARE.STAN_PRESENT_FLOWMETER_TOTAL_QUALITY);
}
}

View File

@ -71,6 +71,7 @@ public class VideoWebPage : PanelBase
//T_BAS_CAMERA.CameraID, DeviceBase.T_BAS_CAMERA.CUSTOMS_CODE, DeviceBase.T_BAS_CAMERA.MONITOR_ID
var _url = ApiManager.Instance.ApiDic["VideoWebUrl"].Replace("IP", CallForTest.instance.ServerIP) +
"?id=" + _T_BAS_CAMERA.CameraID + "&CobCustomId=" + _T_BAS_CAMERA.CUSTOMS_CODE + "&EnterpriseCode=" + _T_BAS_CAMERA.MONITOR_ID;
WebPage.Url = _url;
//WebPage.Url = _url;
WebPage.Url = "www.baidu.com";
}
}

View File

@ -71,10 +71,10 @@ public class YardItem : MonoBehaviour
ShipName.text = T_STK_STORAGE.SHIP_NAME_EN;
Voyage.text = T_STK_STORAGE.VOYAGE_NO;
BillNo.text = T_STK_STORAGE.BILL_NO;
BillGrossWeight.text =float.Parse( T_STK_STORAGE.BILL_GROSS_WT.ToString()).ToString("F2");
OneTradeReleaseVolume.text = float.Parse(T_STK_STORAGE.TRADE_RELEASE.ToString()).ToString("F2");
OneTradeUnreleaseVolume.text = float.Parse(T_STK_STORAGE.TRADE_UNRELEASE.ToString()).ToString("F2");
RemainingInventory.text = float.Parse(T_STK_STORAGE.STOCK_BALANCE.ToString()).ToString("F2");
BillGrossWeight.text = HelpTool.Kg2Ton(T_STK_STORAGE.BILL_GROSS_WT);
OneTradeReleaseVolume.text = HelpTool.Kg2Ton(T_STK_STORAGE.TRADE_RELEASE);
OneTradeUnreleaseVolume.text = HelpTool.Kg2Ton(T_STK_STORAGE.TRADE_UNRELEASE);
RemainingInventory.text = HelpTool.Kg2Ton(T_STK_STORAGE.STOCK_BALANCE);
LastUpdateDate.text = T_STK_STORAGE.MODIFY_DATE.ToString();
Background.sprite = transform.GetSiblingIndex() % 2 == 0 ? SpriteOne : SpriteTwo;

View File

@ -25,6 +25,6 @@ public class BeltScaleDeviceUI : DeviceUIBase, IPointerClickHandler
/// <param name="_T_ALM_PIPECOLLDATA"></param>
public void UpdateRtValue(T_ALM_PIPECOLLDATA _T_ALM_PIPECOLLDATA)
{
BeltScaleRealTimeValue.text = float.Parse(_T_ALM_PIPECOLLDATA.STAN_PRESENT_FLOWMETER_TOTAL_QUALITY.ToString()).ToString("F2");
BeltScaleRealTimeValue.text = HelpTool.Kg2Ton(_T_ALM_PIPECOLLDATA.STAN_PRESENT_FLOWMETER_TOTAL_QUALITY);
}
}

View File

@ -46,6 +46,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_ShowStartLine");
PropertyField(prop, "m_ShowEndLine");
PropertyField(prop, "m_ShowZLine");
}
}

View File

@ -0,0 +1,23 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ViewControl), true)]
public class ViewControlDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ViewControl"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Alpha");
PropertyField(prop, "m_Beta");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: faeb8611591ee4c038e88fdb5a67b5ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -64,6 +64,7 @@ namespace XCharts.Editor
if (type == Axis.AxisType.Category)
{
PropertyField("m_MaxCache");
PropertyField("m_MinCategorySpacing");
PropertyField("m_BoundaryGap");
}
else
@ -106,6 +107,15 @@ namespace XCharts.Editor
[ComponentEditor(typeof(YAxis))]
public class YAxisEditor : AxisEditor { }
[ComponentEditor(typeof(XAxis3D))]
public class XAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(YAxis3D))]
public class YAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(ZAxis3D))]
public class ZAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(SingleAxis))]
public class SingleAxisEditor : AxisEditor
{

View File

@ -0,0 +1,23 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridCoord3D))]
public class GridCoord3DEditor : MainComponentEditor<GridCoord3D>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Left");
PropertyField("m_Bottom");
PropertyField("m_BoxWidth");
PropertyField("m_BoxHeight");
PropertyField("m_BoxDepth");
PropertyField("m_XYExchanged");
PropertyField("m_ShowBorder");
PropertyField("m_ViewControl");
--EditorGUI.indentLevel;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c9a4a8a30b1124c4e996e234d5717a07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -11,13 +11,10 @@ namespace XCharts.Editor
++EditorGUI.indentLevel;
var layoutIndex = baseProperty.FindPropertyRelative("m_LayoutIndex").intValue;
PropertyField("m_LayoutIndex");
if (layoutIndex < 0)
{
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
}
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_BackgroundColor");
PropertyField("m_ShowBorder");
PropertyField("m_BorderWidth");

View File

@ -11,6 +11,7 @@ namespace XCharts.Editor
++EditorGUI.indentLevel;
PropertyField("m_Type");
PropertyField("m_Trigger");
PropertyField("m_TriggerOn");
PropertyField("m_Position");
PropertyField("m_FixedX");
PropertyField("m_FixedY");

View File

@ -9,8 +9,8 @@ namespace XCharts.Editor
{
public class SerieBaseEditor
{
internal BaseChart chart { get; private set; }
internal Serie serie { get; private set; }
public BaseChart chart { get; private set; }
public Serie serie { get; private set; }
//Editor m_Inspector;
internal SerializedProperty baseProperty;

View File

@ -53,14 +53,18 @@ namespace XCharts.Editor
}
}
private HeaderMenuInfo headMenuInfo = new HeaderMenuInfo("Import ECharts Data", null);
private void HeadMenuInfoCallback()
{
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
PraseExternalDataEditor.ShowWindow();
}
private void PropertyFieldData()
{
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null,
new HeaderMenuInfo("Import ECharts Data", () =>
{
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
PraseExternalDataEditor.ShowWindow();
}));
headMenuInfo.action = HeadMenuInfoCallback;
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null, headMenuInfo);
if (!m_DataFoldout) return;
EditorGUI.indentLevel++;
var m_Datas = FindProperty("m_Data");
@ -103,14 +107,18 @@ namespace XCharts.Editor
EditorGUI.indentLevel--;
}
private HeaderMenuInfo linkHeadMenuInfo = new HeaderMenuInfo("Import ECharts Link", null);
private void LinkHeadMenuInfoCallback()
{
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
PraseExternalDataEditor.ShowWindow();
}
protected void PropertyFieldLinks()
{
m_LinksFoldout = ChartEditorHelper.DrawHeader("Links", m_LinksFoldout, false, null, null,
new HeaderMenuInfo("Import ECharts Link", () =>
{
//PraseExternalDataEditor.UpdateData(chart, serie, null, true);
//PraseExternalDataEditor.ShowWindow();
}));
linkHeadMenuInfo.action = LinkHeadMenuInfoCallback;
m_LinksFoldout = ChartEditorHelper.DrawHeader("Links", m_LinksFoldout, false, null, null, linkHeadMenuInfo);
if (!m_LinksFoldout) return;
EditorGUI.indentLevel++;
var m_Links = FindProperty("m_Links");
@ -154,6 +162,84 @@ namespace XCharts.Editor
}
}
private void DrawSerieDataHeader(Rect drawRect, HeaderCallbackContext context)
{
var serieData = context.serieData;
var fieldCount = context.fieldCount;
var showName = context.showName;
var index = context.index;
var dimension = context.dimension;
//drawRect.width -= 2f;
var maxX = drawRect.xMax;
var currentWidth = drawRect.width;
var lastX = drawRect.x;
var lastWid = drawRect.width;
var lastFieldWid = EditorGUIUtility.fieldWidth;
var lastLabelWid = EditorGUIUtility.labelWidth;
var sereName = serieData.FindPropertyRelative("m_Name");
var data = serieData.FindPropertyRelative("m_Data");
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
var buttomLength = 30;
#else
var gap = 0;
var namegap = 0;
var buttomLength = 30;
#endif
if (showName)
{
buttomLength += 12;
}
if (fieldCount <= 1)
{
while (2 > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
drawRect.x = startX;
drawRect.xMax = maxX - buttomLength;
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
else
{
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
var dataWidTotal = currentWidth - (startX + 20.5f + 1) - buttomLength;
var dataWid = dataWidTotal / fieldCount;
var xWid = dataWid - 0;
for (int i = 0; i < dimension; i++)
{
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + 25;
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
if (showName)
{
drawRect.x = startX + (fieldCount - 1) * xWid;
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
}
drawRect.x = lastX;
drawRect.width = lastWid;
ChartEditorHelper.UpDownAddDeleteButton(drawRect, context.listProp, index);
EditorGUIUtility.fieldWidth = lastFieldWid;
EditorGUIUtility.labelWidth = lastLabelWid;
}
}
private void DrawSerieData(int dimension, SerializedProperty m_Datas, int index, bool showName)
{
bool flag;
@ -165,70 +251,16 @@ namespace XCharts.Editor
var fieldCount = dimension + (showName ? 1 : 0);
var serieData = m_Datas.GetArrayElementAtIndex(index);
var dataIndex = serieData.FindPropertyRelative("m_Index").intValue;
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + dataIndex, flag, false, null,
delegate (Rect drawRect)
{
//drawRect.width -= 2f;
var maxX = drawRect.xMax;
var currentWidth = drawRect.width;
var lastX = drawRect.x;
var lastWid = drawRect.width;
var lastFieldWid = EditorGUIUtility.fieldWidth;
var lastLabelWid = EditorGUIUtility.labelWidth;
//var serieData = m_Datas.GetArrayElementAtIndex(index);
var sereName = serieData.FindPropertyRelative("m_Name");
var data = serieData.FindPropertyRelative("m_Data");
#if UNITY_2019_3_OR_NEWER
var gap = 2;
var namegap = 3;
#else
var gap = 0;
var namegap = 0;
#endif
if (fieldCount <= 1)
{
while (2 > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
SerializedProperty element = data.GetArrayElementAtIndex(1);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
drawRect.x = startX;
drawRect.xMax = maxX;
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
else
{
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
var dataWid = dataWidTotal / fieldCount;
var xWid = dataWid - 0;
for (int i = 0; i < dimension; i++)
{
var dataCount = i < 1 ? 2 : i + 1;
while (dataCount > data.arraySize)
{
var value = data.arraySize == 0 ? index : 0;
data.arraySize++;
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
}
drawRect.x = startX + i * xWid;
drawRect.width = dataWid + 25;
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
}
if (showName)
{
drawRect.x = startX + (fieldCount - 1) * xWid;
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
}
EditorGUIUtility.fieldWidth = lastFieldWid;
EditorGUIUtility.labelWidth = lastLabelWid;
}
});
var callbackContext = new HeaderCallbackContext()
{
serieData = serieData,
fieldCount = fieldCount,
showName = showName,
index = index,
dimension = dimension,
listProp = m_Datas
};
m_DataElementFoldout[index] = ChartEditorHelper.DrawSerieDataHeader("SerieData " + dataIndex, flag, false, null, callbackContext, DrawSerieDataHeader);
if (m_DataElementFoldout[index])
{
if (!(serie is ISimplifiedSerie))
@ -306,7 +338,10 @@ namespace XCharts.Editor
var sourceIndex = dataLink.FindPropertyRelative("m_Source");
var targetIndex = dataLink.FindPropertyRelative("m_Target");
var value = dataLink.FindPropertyRelative("m_Value");
ChartEditorHelper.MakeThreeField(ref drawRect, drawRect.width, sourceIndex, targetIndex, value, "");
var hig = ChartEditorHelper.MakeThreeField(ref drawRect, drawRect.width, sourceIndex, targetIndex, value, "");
var btnRect = drawRect;
btnRect.y -= hig;
ChartEditorHelper.UpDownAddDeleteButton(btnRect, m_Datas, index);
});
if (m_LinksElementFoldout[index])
{

View File

@ -6,6 +6,16 @@ using XCharts.Runtime;
namespace XCharts.Editor
{
public class HeaderCallbackContext
{
public int fieldCount = 0;
public SerializedProperty serieData;
public bool showName;
public int index;
public int dimension;
public SerializedProperty listProp;
}
public class HeaderMenuInfo
{
public string name;
@ -43,6 +53,8 @@ namespace XCharts.Editor
public const float GAP_WIDTH = 0;
public const float DIFF_WIDTH = 1;
#endif
public const float ICON_WIDHT = 10;
public const float ICON_GAP = 0;
static Dictionary<string, GUIContent> s_GUIContentCache;
static ChartEditorHelper()
@ -106,21 +118,23 @@ namespace XCharts.Editor
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public static void MakeThreeField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
SerializedProperty prop2, SerializedProperty prop3, string name)
public static float MakeThreeField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
SerializedProperty prop2, SerializedProperty prop3, string name, bool btnSpacing = true)
{
EditorGUI.LabelField(drawRect, name);
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
var diff = 13 + EditorGUI.indentLevel * 14;
var diff = 13f + EditorGUI.indentLevel * 14;
var offset = diff - INDENT_WIDTH;
var tempWidth = (rectWidth - startX + diff) / 3;
var tempWidth = (rectWidth - startX + diff - (btnSpacing ? (ICON_WIDHT + ICON_GAP) * 4 : 0)) / 3 + 8.5f;
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
var centerZRect = new Rect(centerYRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
EditorGUI.PropertyField(centerZRect, prop3, GUIContent.none);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
var hig = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
drawRect.y += hig;
return hig;
}
public static void MakeVector2(ref Rect drawRect, float rectWidth, SerializedProperty prop, string name)
@ -335,15 +349,12 @@ namespace XCharts.Editor
{
EditorGUI.indentLevel++;
var listSize = listProp.arraySize;
var iconWidth = 10;
var iconGap = 0f;
if (showSize)
{
var headerHeight = DrawSplitterAndBackground(drawRect);
if (showOrder)
{
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth + 2, drawRect.height);
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - ICON_WIDHT + 2, drawRect.height);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
GUI.contentColor = oldColor;
@ -396,40 +407,14 @@ namespace XCharts.Editor
DrawSplitterAndBackground(drawRect);
if (showOrder)
{
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
var isSerie = "Serie".Equals(element.type);
var elementRect = isSerie ?
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height) :
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * iconWidth, drawRect.height);
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * ICON_GAP, drawRect.height) :
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * ICON_WIDHT, drawRect.height);
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
var iconRect = new Rect(drawRect.width - 4 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
}
iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
}
iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
}
iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
}
else
{
drawRect.y += EditorGUI.GetPropertyHeight(element);
height += EditorGUI.GetPropertyHeight(element);
}
GUI.contentColor = oldColor;
UpDownAddDeleteButton(drawRect, listProp, i);
drawRect.y += EditorGUI.GetPropertyHeight(element);
height += EditorGUI.GetPropertyHeight(element);
}
else
{
@ -442,6 +427,34 @@ namespace XCharts.Editor
EditorGUI.indentLevel--;
}
public static void UpDownAddDeleteButton(Rect drawRect, SerializedProperty listProp, int i)
{
var temp = INDENT_WIDTH + GAP_WIDTH + ICON_GAP;
var iconRect = new Rect(drawRect.width - 4 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
var oldColor = GUI.contentColor;
GUI.contentColor = Color.black;
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
{
if (i > 0) listProp.MoveArrayElement(i, i - 1);
}
iconRect = new Rect(drawRect.width - 3 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
}
iconRect = new Rect(drawRect.width - 2 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
}
iconRect = new Rect(drawRect.width - ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
{
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
}
GUI.contentColor = oldColor;
}
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
SerializedProperty prop)
{
@ -586,6 +599,31 @@ namespace XCharts.Editor
return state;
}
public static bool DrawSerieDataHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
HeaderCallbackContext context, Action<Rect, HeaderCallbackContext> drawCallback, params HeaderMenuInfo[] menus)
{
var rect = GUILayoutUtility.GetRect(1f, HEADER_HEIGHT);
var labelRect = DrawHeaderInternal(rect, title, ref state, drawBackground, activeField);
DrawMenu(rect, menus);
if (drawCallback != null)
{
drawCallback(rect, context);
}
var e = Event.current;
if (e.type == EventType.MouseDown)
{
if (labelRect.Contains(e.mousePosition))
{
if (e.button == 0)
{
state = !state;
e.Use();
}
}
}
return state;
}
internal static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
Action<Rect> drawCallback, List<HeaderMenuInfo> menus)
{

View File

@ -8,6 +8,8 @@ namespace XCharts.Editor
{
public class PraseExternalDataEditor : UnityEditor.EditorWindow
{
[SerializeField] private int m_DataDimension = 1;
[SerializeField] private double m_DefaultYValue = 0;
private static BaseChart s_Chart;
private static Serie s_Serie;
private static Axis s_Axis;
@ -46,8 +48,13 @@ namespace XCharts.Editor
return;
}
EditorGUILayout.LabelField("Input external data (echarts data):");
m_DataDimension = EditorGUILayout.IntField("Data Dimension", m_DataDimension);
if (m_DataDimension < 1)
m_DataDimension = 1;
else if (m_DataDimension == 2)
m_DefaultYValue = EditorGUILayout.DoubleField("Default Y Value", m_DefaultYValue);
inputJsonText = EditorGUILayout.TextArea(inputJsonText, GUILayout.Height(400));
if (GUILayout.Button("Add"))
if (GUILayout.Button("Try Add"))
{
if (s_Serie != null)
{
@ -76,7 +83,7 @@ namespace XCharts.Editor
}
}
private static bool ParseArrayData(Axis axis, string arrayData)
private bool ParseArrayData(Axis axis, string arrayData)
{
arrayData = arrayData.Trim();
if (!arrayData.StartsWith("data: Array")) return false;
@ -95,7 +102,7 @@ namespace XCharts.Editor
return true;
}
private static bool ParseArrayData(Serie serie, string arrayData)
private bool ParseArrayData(Serie serie, string arrayData)
{
arrayData = arrayData.Trim();
if (!arrayData.StartsWith("data: Array")) return false;
@ -120,7 +127,7 @@ namespace XCharts.Editor
return true;
}
private static bool ParseJsonData(Axis axis, string jsonData)
private bool ParseJsonData(Axis axis, string jsonData)
{
if (!CheckJsonData(ref jsonData)) return false;
axis.data.Clear();
@ -140,7 +147,7 @@ namespace XCharts.Editor
/// 从json中导入数据
/// </summary>
/// <param name="jsonData"></param>
private static bool ParseJsonData(Serie serie, string jsonData)
private bool ParseJsonData(Serie serie, string jsonData)
{
if (!CheckJsonData(ref jsonData)) return false;
if (s_LinksData) serie.ClearLinks();
@ -156,7 +163,10 @@ namespace XCharts.Editor
if (data.Length == 2 && !double.TryParse(data[0], out value))
{
double.TryParse(data[1], out value);
serieData.data = new List<double>() { i, value };
if (m_DataDimension == 2)
serieData.data = new List<double>() { i, m_DefaultYValue, value };
else
serieData.data = new List<double>() { i, value };
serieData.name = data[0].Replace("\"", "").Trim();
}
else
@ -187,7 +197,10 @@ namespace XCharts.Editor
if (a.StartsWith("value:"))
{
double value = double.Parse(a.Substring(6, a.Length - 6));
serieData.data = new List<double>() { i, value };
if (m_DataDimension == 2)
serieData.data = new List<double>() { i, m_DefaultYValue, value };
else
serieData.data = new List<double>() { i, value };
}
else if (a.StartsWith("name:"))
{
@ -213,7 +226,10 @@ namespace XCharts.Editor
if (flag)
{
var serieData = new SerieData();
serieData.data = new List<double>() { i, value };
if (m_DataDimension == 2)
serieData.data = new List<double>() { i, m_DefaultYValue, value };
else
serieData.data = new List<double>() { i, value };
serie.AddSerieData(serieData);
}
}

View File

@ -14,14 +14,14 @@ namespace XCharts.Editor
public partial class XChartsEditor
{
[MenuItem("XCharts/BarChart/Baisc Column", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Baisc Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Column", priority = 45)]
public static void AddBarChart()
{
AddChart<BarChart>("BarChart");
}
[MenuItem("XCharts/BarChart/Zebra Column", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Zebra Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Column", priority = 45)]
public static void AddBarChart_ZebraColumn()
{
var chart = AddChart<BarChart>("BarChart", "Zebra Column");
@ -29,7 +29,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Capsule Column", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Capsule Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Column", priority = 45)]
public static void AddBarChart_CapsuleColumn()
{
var chart = AddChart<BarChart>("BarChart", "Capsule Column");
@ -37,7 +37,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Grouped Column", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Grouped Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Column", priority = 45)]
public static void AddBarChart_GroupedColumn()
{
var chart = AddChart<BarChart>("BarChart", "Grouped Column");
@ -45,7 +45,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Stacked Column", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Stacked Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Column", priority = 45)]
public static void AddBarChart_StackedColumn()
{
var chart = AddChart<BarChart>("BarChart", "Stacked Column");
@ -53,7 +53,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Percent Column", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Percent Column", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Column", priority = 45)]
public static void AddBarChart_PercentColumn()
{
var chart = AddChart<BarChart>("BarChart", "Percent Column");
@ -61,7 +61,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Baisc Bar", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Baisc Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Bar", priority = 45)]
public static void AddBarChart_BasicBar()
{
var chart = AddChart<BarChart>("BarChart");
@ -69,7 +69,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Zebra Bar", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Zebra Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Bar", priority = 45)]
public static void AddBarChart_ZebraBar()
{
var chart = AddChart<BarChart>("BarChart", "Zebra Bar");
@ -77,7 +77,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Capsule Bar", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Capsule Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Bar", priority = 45)]
public static void AddBarChart_CapsuleBar()
{
var chart = AddChart<BarChart>("BarChart", "Capsule Bar");
@ -85,7 +85,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Grouped Bar", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Grouped Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Bar", priority = 45)]
public static void AddBarChart_GroupedBar()
{
var chart = AddChart<BarChart>("BarChart", "Grouped Bar");
@ -93,7 +93,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Stacked Bar", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Stacked Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Bar", priority = 45)]
public static void AddBarChart_StackedBar()
{
var chart = AddChart<BarChart>("BarChart", "Stacked Bar");
@ -101,7 +101,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/BarChart/Percent Bar", priority = 45)]
[MenuItem("GameObject/XCharts/BarChart/Percent Bar", priority = 45)]
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Bar", priority = 45)]
public static void AddBarChart_PercentBar()
{
var chart = AddChart<BarChart>("BarChart", "Percent Bar");

View File

@ -14,14 +14,14 @@ namespace XCharts.Editor
public partial class XChartsEditor
{
[MenuItem("XCharts/LineChart/Basic Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Basic Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Basic Line", priority = 44)]
public static void AddLineChart()
{
AddChart<LineChart>("LineChart");
}
[MenuItem("XCharts/LineChart/Area Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Area Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Area Line", priority = 44)]
public static void AddLineChart_Area()
{
var chart = AddChart<LineChart>("LineChart_Area", "Area Line");
@ -29,7 +29,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Smooth Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Smooth Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Line", priority = 44)]
public static void AddLineChart_Smooth()
{
var chart = AddChart<LineChart>("LineChart_Smooth", "Smooth Line");
@ -37,7 +37,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Smooth Area", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Smooth Area Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Area Line", priority = 44)]
public static void AddLineChart_SmoothArea()
{
var chart = AddChart<LineChart>("LineChart_SmoothArea", "Smooth Area Line");
@ -45,7 +45,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Stack Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Stack Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Line", priority = 44)]
public static void AddLineChart_Stack()
{
var chart = AddChart<LineChart>("LineChart_Stack", "Stack Line");
@ -53,7 +53,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Stack Area Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Stack Area Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Area Line", priority = 44)]
public static void AddLineChart_StackArea()
{
var chart = AddChart<LineChart>("LineChart_StackArea", "Stack Area Line");
@ -61,7 +61,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Step Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Step Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Step Line", priority = 44)]
public static void AddLineChart_Step()
{
var chart = AddChart<LineChart>("LineChart_Step", "Step Line");
@ -69,7 +69,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Dashed Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Dashed Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Dashed Line", priority = 44)]
public static void AddLineChart_Dash()
{
var chart = AddChart<LineChart>("LineChart_Dashed", "Dashed Line");
@ -77,7 +77,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Time Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Time Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Time Line", priority = 44)]
public static void AddLineChart_Time()
{
var chart = AddChart<LineChart>("LineChart_Time", "Time Line");
@ -85,7 +85,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/LineChart/Log Line", priority = 44)]
[MenuItem("GameObject/XCharts/LineChart/Log Line", priority = 44)]
[MenuItem("GameObject/UI/XCharts/LineChart/Log Line", priority = 44)]
public static void AddLineChart_Log()
{
var chart = AddChart<LineChart>("LineChart_Log", "Log Line");

View File

@ -14,14 +14,14 @@ namespace XCharts.Editor
public partial class XChartsEditor
{
[MenuItem("XCharts/PieChart/Pie", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart/Pie", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Pie", priority = 46)]
public static void AddPieChart()
{
AddChart<PieChart>("PieChart");
}
[MenuItem("XCharts/PieChart/Pie With Label", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart/Pie With Label", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Pie With Label", priority = 46)]
public static void AddPieChart_WithLabel()
{
var chart = AddChart<PieChart>("PieChart");
@ -29,7 +29,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/PieChart/Donut", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart/Donut", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Donut", priority = 46)]
public static void AddPieChart_Donut()
{
var chart = AddChart<PieChart>("PieChart");
@ -37,7 +37,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/PieChart/Donut With Label", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart/Donut With Label", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Donut With Label", priority = 46)]
public static void AddPieChart_DonutWithLabel()
{
var chart = AddChart<PieChart>("PieChart");
@ -45,7 +45,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/PieChart/Radius Rose", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart/Radius Rose", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Radius Rose", priority = 46)]
public static void AddPieChart_RadiusRose()
{
var chart = AddChart<PieChart>("PieChart");
@ -53,7 +53,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/PieChart/Area Rose", priority = 46)]
[MenuItem("GameObject/XCharts/PieChart/Area Rose", priority = 46)]
[MenuItem("GameObject/UI/XCharts/PieChart/Area Rose", priority = 46)]
public static void AddPieChart_AreaRose()
{
var chart = AddChart<PieChart>("PieChart");

View File

@ -14,14 +14,14 @@ namespace XCharts.Editor
public partial class XChartsEditor
{
[MenuItem("XCharts/PolarChart/Line", priority = 54)]
[MenuItem("GameObject/XCharts/PolarChart/Line", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Line", priority = 54)]
public static void PolarChart()
{
AddChart<PolarChart>("PolarChart");
}
[MenuItem("XCharts/PolarChart/Radial Bar", priority = 54)]
[MenuItem("GameObject/XCharts/PolarChart/Radial Bar", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Radial Bar", priority = 54)]
public static void PolarChart_RadialBar()
{
var chart = AddChart<PolarChart>("PolarChart");
@ -29,7 +29,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/PolarChart/Tangential Bar", priority = 54)]
[MenuItem("GameObject/XCharts/PolarChart/Tangential Bar", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Tangential Bar", priority = 54)]
public static void PolarChart_TangentialBar()
{
var chart = AddChart<PolarChart>("PolarChart");
@ -37,7 +37,7 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/PolarChart/Heatmap", priority = 54)]
[MenuItem("GameObject/XCharts/PolarChart/Heatmap", priority = 54)]
[MenuItem("GameObject/UI/XCharts/PolarChart/Heatmap", priority = 54)]
public static void PolarChart_Heatmap()
{
var chart = AddChart<PolarChart>("PolarChart");

View File

@ -96,21 +96,21 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/EmptyChart", priority = 43)]
[MenuItem("GameObject/XCharts/EmptyChart", priority = 43)]
[MenuItem("GameObject/UI/XCharts/EmptyChart", priority = 43)]
public static void AddBaseChart()
{
AddChart<BaseChart>("EmptyChart");
}
[MenuItem("XCharts/RadarChart/Polygon Radar", priority = 47)]
[MenuItem("GameObject/XCharts/RadarChart/Polygon Radar", priority = 47)]
[MenuItem("GameObject/UI/XCharts/RadarChart/Polygon Radar", priority = 47)]
public static void AddRadarChart()
{
AddChart<RadarChart>("RadarChart");
}
[MenuItem("XCharts/RadarChart/Cirle Radar", priority = 47)]
[MenuItem("GameObject/XCharts/RadarChart/Cirle Radar", priority = 47)]
[MenuItem("GameObject/UI/XCharts/RadarChart/Cirle Radar", priority = 47)]
public static void AddRadarChart_CirleRadar()
{
var chart = AddChart<RadarChart>("RadarChart");
@ -118,14 +118,14 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/ScatterChart/Scatter", priority = 48)]
[MenuItem("GameObject/XCharts/ScatterChart/Scatter", priority = 48)]
[MenuItem("GameObject/UI/XCharts/ScatterChart/Scatter", priority = 48)]
public static void AddScatterChart()
{
AddChart<ScatterChart>("ScatterChart");
}
[MenuItem("XCharts/ScatterChart/Bubble", priority = 48)]
[MenuItem("GameObject/XCharts/ScatterChart/Bubble", priority = 48)]
[MenuItem("GameObject/UI/XCharts/ScatterChart/Bubble", priority = 48)]
public static void AddScatterChart_Bubble()
{
var chart = AddChart<ScatterChart>("ScatterChart");
@ -133,14 +133,14 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/HeatmapChart/Heatmap", priority = 49)]
[MenuItem("GameObject/XCharts/HeatmapChart/Heatmap", priority = 49)]
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Heatmap", priority = 49)]
public static void AddHeatmapChart()
{
AddChart<HeatmapChart>("HeatmapChart");
}
[MenuItem("XCharts/HeatmapChart/Count Heatmap", priority = 49)]
[MenuItem("GameObject/XCharts/HeatmapChart/Count Heatmap", priority = 49)]
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Count Heatmap", priority = 49)]
public static void AddHeatmapChart_Count()
{
var chart = AddChart<HeatmapChart>("HeatmapChart");
@ -148,14 +148,14 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/RingChart/Ring", priority = 51)]
[MenuItem("GameObject/XCharts/RingChart/Ring", priority = 51)]
[MenuItem("GameObject/UI/XCharts/RingChart/Ring", priority = 51)]
public static void AddRingChart()
{
AddChart<RingChart>("RingChart");
}
[MenuItem("XCharts/RingChart/Multiple Ring", priority = 51)]
[MenuItem("GameObject/XCharts/RingChart/Multiple Ring", priority = 51)]
[MenuItem("GameObject/UI/XCharts/RingChart/Multiple Ring", priority = 51)]
public static void AddRingChart_MultiRing()
{
var chart = AddChart<RingChart>("RingChart");
@ -163,35 +163,35 @@ namespace XCharts.Editor
}
[MenuItem("XCharts/CandlestickChart/Candlestick", priority = 54)]
[MenuItem("GameObject/XCharts/CandlestickChart/Candlestick", priority = 54)]
[MenuItem("GameObject/UI/XCharts/CandlestickChart/Candlestick", priority = 54)]
public static void CandlestickChart()
{
AddChart<CandlestickChart>("CandlestickChart");
}
[MenuItem("XCharts/ParallelChart/Parallel", priority = 55)]
[MenuItem("GameObject/XCharts/ParallelChart/Parallel", priority = 55)]
[MenuItem("GameObject/UI/XCharts/ParallelChart/Parallel", priority = 55)]
public static void ParallelChart()
{
AddChart<ParallelChart>("ParallelChart");
}
[MenuItem("XCharts/SimplifiedChart/Line", priority = 56)]
[MenuItem("GameObject/XCharts/SimplifiedChart/Line", priority = 56)]
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Line", priority = 56)]
public static void SimplifiedLineChart()
{
AddChart<SimplifiedLineChart>("SimplifiedLineChart");
}
[MenuItem("XCharts/SimplifiedChart/Bar", priority = 57)]
[MenuItem("GameObject/XCharts/SimplifiedChart/Bar", priority = 57)]
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Bar", priority = 57)]
public static void SimplifiedBarChart()
{
AddChart<SimplifiedBarChart>("SimplifiedBarChart");
}
[MenuItem("XCharts/SimplifiedChart/Candlestick", priority = 58)]
[MenuItem("GameObject/XCharts/SimplifiedChart/Candlestick", priority = 58)]
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Candlestick", priority = 58)]
public static void SimplifiedCandlestickChart()
{
AddChart<SimplifiedCandlestickChart>("SimplifiedCandlestickChart");

View File

@ -17,24 +17,52 @@ namespace XCharts.Example
public bool loopUpdate = false;
public float loopUpadteTime = 1f;
public int maxCache = 0;
public bool insertDataToHead = false;
BaseChart chart;
float lastAddTime;
float lastUpdateTime;
int dataCount;
int lastMaxCache = 0;
bool lastInsertDataToHead = false;
void Awake()
{
chart = gameObject.GetComponent<BaseChart>();
chart.onInit = () =>
{
dataCount = chart.GetSerie(0).dataCount;
SetMaxCache(maxCache);
SetInsertDataToHead(insertDataToHead);
lastMaxCache = maxCache;
lastInsertDataToHead = insertDataToHead;
};
}
void Start()
void SetMaxCache(int maxCache)
{
if (maxCache > 0)
chart.SetMaxCache(maxCache);
}
void SetInsertDataToHead(bool insertDataToHead)
{
foreach (var serie in chart.series)
serie.insertDataToHead = insertDataToHead;
var coms = chart.GetChartComponents<XAxis>();
if (coms != null)
{
chart.SetMaxCache(maxCache);
foreach (var com in coms)
{
var axis = com as XAxis;
if (axis.type == Axis.AxisType.Category)
{
axis.insertDataToHead = insertDataToHead;
Debug.LogError("axis:" + axis + "," + insertDataToHead);
}
}
}
dataCount = chart.GetSerie(0).dataCount;
}
void Update()
@ -51,6 +79,16 @@ namespace XCharts.Example
{
chart.ClearData();
}
if (lastMaxCache != maxCache)
{
lastMaxCache = maxCache;
SetMaxCache(maxCache);
}
if (lastInsertDataToHead != insertDataToHead)
{
lastInsertDataToHead = insertDataToHead;
SetInsertDataToHead(insertDataToHead);
}
lastAddTime += Time.deltaTime;
if (loopAdd && lastAddTime >= loopAddTime)
{
@ -84,14 +122,8 @@ namespace XCharts.Example
}
else
{
AddXAxisData();
var xAxis = chart.GetChartComponent<XAxis>();
if (xAxis != null)
{
if (xAxis.type == Axis.AxisType.Category)
{
chart.AddXAxisData("x" + (xAxis.GetAddedDataCount() + 1));
}
}
foreach (var serie in chart.series)
{
AddSerieRandomData(serie, xAxis);
@ -99,6 +131,19 @@ namespace XCharts.Example
}
}
void AddXAxisData()
{
var xAxes = chart.GetChartComponents<XAxis>();
foreach (var com in xAxes)
{
var xAxis = com as XAxis;
if (xAxis.type == Axis.AxisType.Category)
{
chart.AddXAxisData("x" + (xAxis.GetAddedDataCount() + 1), xAxis.index);
}
}
}
void UpdateData()
{
foreach (var serie in chart.series)

View File

@ -34,7 +34,7 @@ namespace XCharts.Example
void AddData()
{
chart.RemoveData();
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.Corss;
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.Cross;
var angleAxis = chart.GetChartComponent<AngleAxis>();
angleAxis.type = Axis.AxisType.Value;
angleAxis.minMaxType = Axis.AxisMinMaxType.Custom;

View File

@ -5,11 +5,8 @@ PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:

View File

@ -45,38 +45,35 @@
![XCharts](Documentation~/zh/img/xcharts.png)
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extended charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, and treemap.
## Overview
[XCharts3.0 Homepage](https://xcharts-team.github.io)
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extended charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, treemap, sankey, line3d and graph chart.
[XCharts3.0 Tutorial](Documentation~/en/tutorial01.md)
[XCharts3.0 API](Documentation~/en/api.md)
[XCharts3.0 FAQ](Documentation~/en/faq.md)
[XCharts3.0 Configurate](Documentation~/en/configuration.md)
[XCharts3.0 Changelog](Documentation~/en/changelog.md)
[XCharts3.0 Support](Documentation~/en/support.md)
## Key Features
## Features
- __Pure Code Rendering__: Charts are rendered with pure code, eliminating the need for extra texture or shader resources.
- __Visual Configuration__: Configure parameters visually with real-time preview and support for dynamic configuration and data adjustments at runtime.
- __High Customizability__: Themes and configuration parameters can be adjusted as needed, with support for custom drawing and callbacks.
- __Built-in and Extended Charts__: Supports a variety of chart types, including 3D charts and special chart types like gauges and treemaps.
- __Multiple Chart Combinations__: Combine multiple charts of the same or different types within a single instance.
- __Various Coordinate Systems__: Supports different coordinate systems such as Cartesian, polar, and single axes.
- __Rich Components__: Includes titles, legends, tooltips, and more.
- __Custom Drawing__: Utilize a powerful API for custom drawing of points, lines, and other graphics.
- __Large Data Rendering__: Capable of rendering tens of thousands of data points with support for sampling rendering.
- __Custom Themes__: Customize themes and use the included light and dark default themes.
- __Animations and Interactions__: Supports various animations and interactions for a dynamic user experience.
- __Third-Party Extensions__: Integrates with TextMeshPro and the New Input System.
- __Version and Compatibility__: Compatible with all Unity versions above 5.6 and runs on all platforms.
* __Pure code rendering__: The chart is completely rendered with pure code, without the need for additional texture or shader resources.
* __Visual configuration__: Visual configuration of parameters with real-time preview of the effect, and support for dynamic modification of configuration and data during runtime.
* __High customizability__: Supports arbitrary adjustments from theme and configuration parameters; supports custom drawing, callback functions, and custom implementations of charts.
* __Multiple built-in charts__: Supports various built-in charts such as line charts, bar charts, pie charts, radar charts, scatter plots, heat maps, polar charts, K-line charts, parallel coordinates, etc.
* __Multiple extended charts__: Supports extended charts such as 3D column charts, 3D pie charts, funnel charts, pyramids, dashboards, water level charts, iconic bar charts, Gantt charts, and tree maps.
* __Multiple extended features__: Supports extended UI components such as tables and statistical values.
* __Multiple chart combinations__: Supports arbitrary combinations of built-in charts, with multiple same or different types of charts displayed simultaneously in the same chart.
* __Various coordinate systems__: Supports coordinate systems such as Cartesian coordinates, polar coordinates, and single axes.
* __Rich components__: Supports common components such as titles, legends, tooltips, markings, marking areas, data area zooming, and visual mapping.
* __Rich line charts__: Supports various line charts such as straight line charts, curved line charts, dashed line charts, area charts, step line charts, etc.
* __Rich bar charts__: Supports various bar charts such as stacked bar charts, stacked percentage bar charts, zebra bar charts, and capsule bar charts.
* __Rich pie charts__: Supports various pie charts such as ring charts, rose charts, ring rose charts, etc.
* __Rich lines__: Supports various lines such as solid lines, curves, step lines, dashed lines, dot lines, dotted lines, and double dot-dashed lines.
* __Custom drawing__: Supports custom chart content drawing with powerful drawing APIs for drawing points, lines, and other graphics.
* __Large data rendering__: Supports rendering of tens of thousands of data points; supports sampling rendering; special simplified charts support better performance.
* __Custom themes__: Supports theme customization and import/export; includes both light and dark default themes.
* __Animations and interactions__: Supports various animations such as fade-in animation, fade-out animation, change animation, addition animation, and * interactive animation; supports interactive operations such as data filtering, view zooming, and detailed display on multiple platforms.
* __Third-party extensions__: Supports integration with TexMeshPro and New Input System.
* __Version and compatibility__: Supports all Unity versions above 5.6 and runs on all platforms.
## Documentation
- [XCharts3.0 Homepage](https://xcharts-team.github.io)
- [XCharts3.0 Tutorial](Documentation~/en/tutorial01.md)
- [XCharts3.0 API](Documentation~/en/api.md)
- [XCharts3.0 FAQ](Documentation~/en/faq.md)
- [XCharts3.0 Configurate](Documentation~/en/configuration.md)
- [XCharts3.0 Changelog](Documentation~/en/changelog.md)
- [XCharts3.0 Support](Documentation~/en/support.md)
## Screenshots
@ -84,55 +81,43 @@ A powerful and easy-to-use data visualization library for Unity. It supports mo
![extendchart](Documentation~/en/img/readme_extendchart.png)
## Attention
## Important Notes
* `XCharts3.0` is not fully compatible with `XCharts2.0` version, upgrading `3.0` may require some code adjustments, and some chart configurations need to be readjusting. It is recommended that old projects can continue to use `XCharts2.0`, and new projects are recommended to use `XCharts3.0`.
* `XCharts2.0` enters the maintenance phase, and only serious `bugs` will be fixed later, in principle, no more new features will be added.
* `XCharts` theoretically supports `Unity 5.6` and above, but due to limited version testing, it is inevitable to slip up, and version compatibility issues can be raised.
* This repository only contains `XCharts` source code, does not contain `Demo` sample section. Need to look at ` Demo ` please go to the sample source code [XCharts - Demo](https://github.com/XCharts-Team/XCharts-Demo) repo. You can also view the running effect of `WebGL` in your browser [Online Demo](https://xcharts-team.github.io/examples/).
- `XCharts3.0` is not fully compatible with `XCharts2.0`. Upgrading to 3.0 may require code adjustments and reconfiguration of some charts.
- `XCharts2.0` is in the maintenance phase with only critical bug fixes applied.
- While XCharts supports Unity 5.6 and above, compatibility issues may arise due to limited testing.
- This repository contains only the `XCharts` source code. For demos, visit the [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) repo or the [Online Demo](https://xcharts-team.github.io/examples/).
## Use
## Getting Started
* Import `XCharts` unitypackage or source code into the project.
* Right-click `Hierarchy` view and choose `XCharts->LineChart` to create a default LineChart.
* You can adjust the parameters of each component in `Inspector` and see the real-time effects in `Game` view.
* For more details, see [[XCharts Tutorial: 5-minute tutorial]](Documentation~/en/tutorial01.md)
* For the first time, it is recommended to read the tutorial carefully.
1. Import the `XCharts` unitypackage or source code into your Unity project.
2. Create a chart by right-clicking in the `Hierarchy` view and selecting `UI->XCharts->LineChart`.
3. Adjust component parameters in the `Inspector` to see real-time effects in the `Game` view.
4. For more details, refer to the [5-minute tutorial](Documentation~/en/tutorial01.md).
## Branch
## Branch Information
* `master` : indicates the development branch. The latest changes and new features are first committed to the `master` branch, and after some time from the `master` branch `merge` to the `3.0` branch, and the `release` version.
* `3.0` : Stable branch of XCharts 3.0. It is generally updated once a month, with the latest changes from the `master` branch `merge`, and the `release` version is released.
* `2.0` : A stable branch of XCharts 2.0. With Demo, currently no longer maintenance, only to modify serious bugs.
* `2.0-upm` : Stable UMP branch of XCharts 2.0. Only the Package part is included without Demo. It is dedicated to the UMP and is not maintained.
* `1.0` : Stable branch of XCharts 1.0. With Demo, no maintenance.
* `1.0-upm` : stable UMP branch of XCharts 1.0. No Demo, no maintenance.
- __master__ indicates the development branch. The latest changes and new features are first committed to the `master` branch, and after some time from the `master` branch `merge` to the `3.0` branch, and the `release` version.
- __3.0__ Stable branch of XCharts 3.0. It is generally updated once a month, with the latest changes from the `master` branch `merge`, and the `release` version is released.
- __2.0__ A stable branch of XCharts 2.0. With Demo, currently no longer maintenance, only to modify serious bugs.
- __2.0-upm__ Stable UMP branch of XCharts 2.0. Only the Package part is included without Demo. It is dedicated to the UMP and is not maintained.
- __1.0__ Stable branch of XCharts 1.0. With Demo, no maintenance.
- __1.0-upm__ stable UMP branch of XCharts 1.0. No Demo, no maintenance.
## FAQ
* Is `XCharts` free to use?
A: `XCharts` uses the `MIT` licence and is free to use. You can also subscribe to `VIP` to enjoy more value-added services.
* Does `XCharts` support code to dynamically add and modify data? Does it support getting data from `Excel` or a database?
A: Support code to dynamically add and modify data, but data needs to be parsed or retrieved by itself, and then added to `XCharts` by calling the public interface of `XCharts`.
* Does this plugin work on other platforms (e.g. Winform or WPF) besides Unity?
A: It is currently only supported on Unity. Theoretically any version of Unity that supports `UGUI` can run `XCharts`.
* What about the jags? What magnitude of data is supported?
A: XCharts is based on UGUI implementation, so the problems encountered in UGUI will also exist in XCharts. For example, the sawtooth problem, such as the number of vertices in `Mesh` exceeds `65535`. Solutions to these two problems can be found in [Q&A 16](Documentation~/en/faq.md) and [Q&A 27](Documentation~/en/faq.md).
Due to the `Mesh` of the `65535` vertex limit, the current `XCharts` single `Line` supports about `20,000` of data, of course, open sampling can support more data to draw, but at the same time it will consume more CPU.
- __Is XCharts free to use?__ Yes, XCharts is free under the MIT license and includes value-added VIP services.
- __Does XCharts support dynamic data addition and modification?__ Yes, but data must be parsed or retrieved by the user.
- __Does this plugin work on platforms other than Unity?__ No, it is designed for Unity only.
## Changelog
* [Changelog](Documentation~/en/changelog.md)
- [Changelog](Documentation~/en/changelog.md)
## Licenses
* [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md)
* Free commercial, secondary development
* The extended charts and advanced features sections require a separate purchase license
- XCharts is released under the [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md).
## Other
## Contact
email: `monitor1394@gmail.com`
- For more information or support, contact us at `monitor1394@gmail.com`.

View File

@ -45,7 +45,7 @@
![XCharts](Documentation~/zh/img/xcharts.png)
一款基于`UGUI`的功能强大、简单易用的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`、`桑基图`等多种扩展图表。
一款基于`UGUI`的功能强大的简单易用的`Unity`数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`、`桑基图`、`3D折线图`、`关系图`等十几种扩展图表。
[XCharts 官方主页](https://xcharts-team.github.io)
[XCharts 在线示例](https://xcharts-team.github.io/examples)
@ -63,7 +63,7 @@
- __可视化配置__:参数可视化配置,效果实时预览,支持运行时代码动态修改配置和数据。
- __高自由定制__:支持从主题和配置参数上任意调整;支持代码自定义绘制,自定义回调以及自定义实现图表。
- __多内置图表__支持线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等多种内置图表。
- __多扩展图表__支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图、桑基图等多种扩展图表。
- __多扩展图表__支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图、桑基图、3D折线图、关系图等多种扩展图表。
- __多扩展组件__支持表格、统计数值等多种扩展UI组件。
- __多图表组合__:支持内置图表的任意组合,同一图中可同时显示多个相同或不同类型的图表。
- __多种坐标系__:支持直角坐标系、极坐标系、单轴等多种坐标系。
@ -87,42 +87,33 @@
## 仓库
| 相关仓库 | 仓库介绍 |
| -- | --|
| [XCharts](https://github.com/XCharts-Team/XCharts) | XCharts核心功能完全免费。 |
| [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon) | XCharts的守护程序用于确保XCharts更新时的编译正常。非必须但建议使用。 |
| [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) | XCharts的官方示例不包含扩展图表部分。订阅VIP的用户购买扩展图表后可加入对应图表的示例。 |
| [XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro) | XCharts完全版包含所有扩展图表和扩展组件。订阅SVIP后可访问使用。 |
| [XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) | XCharts完全版官方示例包含所有扩展图表和扩展组件的示例。订阅SVIP后可访问使用。 |
| [XCharts-UI](https://github.com/XCharts-Team/XCharts-UI) | XCharts的扩展UI组件。订阅VIP后可访问使用。 |
| [XCharts-Bar3DChart](https://github.com/XCharts-Team/XCharts-Bar3DChart) | XCharts扩展图表3D柱图。订阅购买后可访问使用。 |
| [XCharts-FunnelChart](https://github.com/XCharts-Team/XCharts-FunnelChart) | XCharts扩展图表漏斗图。订阅购买后可访问使用。 |
| [XCharts-GanttChart](https://github.com/XCharts-Team/XCharts-GanttChart) | XCharts扩展图表甘特图。订阅购买后可访问使用。 |
| [XCharts-GaugeChart](https://github.com/XCharts-Team/XCharts-GaugeChart) | XCharts扩展图表仪表盘。订阅购买后可访问使用。 |
| [XCharts-LiquidChart](https://github.com/XCharts-Team/XCharts-LiquidChart) | XCharts扩展图表水位图。订阅购买后可访问使用。 |
| [XCharts-PictorialBarChart](https://github.com/XCharts-Team/XCharts-PictorialBarChart) | XCharts扩展图表象形住图。订阅购买后可访问使用。 |
| [XCharts-Pie3DChart](https://github.com/XCharts-Team/XCharts-Pie3DChart) | XCharts扩展图表3D饼图。订阅购买后可访问使用。 |
| [XCharts-PyramidChart](https://github.com/XCharts-Team/XCharts-PyramidChart) | XCharts扩展图表3D金字塔。订阅购买后可访问使用。 |
| [XCharts-TreemapChart](https://github.com/XCharts-Team/XCharts-TreemapChart) | XCharts扩展图表矩形树图。订阅购买后可访问使用。 |
| [XCharts-SankeyChart](https://github.com/XCharts-Team/XCharts-SankeyChart) | XCharts扩展图表桑基图。订阅购买后可访问使用。 |
- __[XCharts](https://github.com/XCharts-Team/XCharts)__ XCharts核心功能完全免费。
- __[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)__ XCharts守护程序用于确保XCharts更新时的编译正常。非必须但建议使用。
- __[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)__ XCharts官方示例不包含扩展图表部分。订阅购买扩展图表后可导入示例。
- __[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)__ XCharts专业版包含所有扩展图表和扩展组件。订阅SVIP后可访问使用。
- __[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo)__ XCharts专业版官方示例包含所有扩展图表和扩展组件的示例。订阅SVIP后可访问使用。
- __[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)__ XCharts的扩展UI组件。订阅VIP后可访问使用。
- __[XCharts-Bar3DChart](https://github.com/XCharts-Team/XCharts-Bar3DChart)__ XCharts扩展图表3D柱图。订阅购买后可访问使用。
- __[XCharts-FunnelChart](https://github.com/XCharts-Team/XCharts-FunnelChart)__ XCharts扩展图表漏斗图。订阅购买后可访问使用。
- __[XCharts-GanttChart](https://github.com/XCharts-Team/XCharts-GanttChart)__ XCharts扩展图表甘特图。订阅购买后可访问使用。
- __[XCharts-GaugeChart](https://github.com/XCharts-Team/XCharts-GaugeChart)__ XCharts扩展图表仪表盘。订阅购买后可访问使用。
- __[XCharts-LiquidChart](https://github.com/XCharts-Team/XCharts-LiquidChart)__ XCharts扩展图表水位图。订阅购买后可访问使用。
- __[XCharts-PictorialBarChart](https://github.com/XCharts-Team/XCharts-PictorialBarChart)__ XCharts扩展图表象形住图。订阅购买后可访问使用。
- __[XCharts-Pie3DChart](https://github.com/XCharts-Team/XCharts-Pie3DChart)__ XCharts扩展图表3D饼图。订阅购买后可访问使用。
- __[XCharts-PyramidChart](https://github.com/XCharts-Team/XCharts-PyramidChart)__ XCharts扩展图表3D金字塔。订阅购买后可访问使用。
- __[XCharts-TreemapChart](https://github.com/XCharts-Team/XCharts-TreemapChart)__ XCharts扩展图表矩形树图。订阅购买后可访问使用。
- __[XCharts-SankeyChart](https://github.com/XCharts-Team/XCharts-SankeyChart)__ XCharts扩展图表桑基图。订阅购买后可访问使用。
- __[XCharts-Line3DChart](https://github.com/XCharts-Team/XCharts-Line3DChart)__ XCharts扩展图表3D折线图。订阅购买后可访问使用。
- __[XCharts-GraphChart](https://github.com/XCharts-Team/XCharts-GraphChart)__ XCharts扩展图表关系图。订阅购买后可访问使用。
## 分支
| 分支 | 分支介绍 |
|--|--|
| [master](https://github.com/XCharts-Team/XCharts/tree/master) | XCharts3.0的开发分支。最新的修改和功能都先提交到`master`分支,稳定后后再从`master`分支`merge`到`3.0`分支,并发布`release`版本。|
| [3.0](https://github.com/XCharts-Team/XCharts/tree/3.0) | XCharts3.0的稳定分支。一般一个月一发布,`master`分支稳定后,`merge`到`3.0`分支,并发布`release`版本。|
| [2.0](https://github.com/XCharts-Team/XCharts/tree/2.0) | XCharts2.0的稳定分支。带Demo目前基本不再维护仅修改严重bug。|
| [2.0-upm](https://github.com/XCharts-Team/XCharts/tree/2.0-upm) | XCharts2.0的稳定UMP分支。不带Demo只包含Package部分不再维护。|
| [1.0](https://github.com/XCharts-Team/XCharts/tree/1.0) | XCharts1.0的稳定分支。带Demo不再维护。|
| [1.0-upm](https://github.com/XCharts-Team/XCharts/tree/1.0-upm) | XCharts1.0的稳定UMP分支。不带Demo不再维护。|
## 注意
- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,升级`3.0`时,部分代码和配置可能需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。
- `XCharts2.0` 进入维护阶段,后续只修复严重`bug`,原则上不再加新功能。
- `XCharts` 理论上支持`Unity 5.6`及以上版本,但由于版本测试有限难免疏漏,发现问题可提`Issue`。
- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`示例源码请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。也可以在浏览器查看`WebGL`下的运行效果 [在线Demo](https://xcharts-team.github.io/examples/) 。
- __[master](https://github.com/XCharts-Team/XCharts/tree/master)__ XCharts3.0的开发分支。最新的修改和功能都先提交到`master`分支,稳定后再发布`release`版本。
- __[3.0](https://github.com/XCharts-Team/XCharts/tree/3.0)__ XCharts3.0的稳定分支。一般一个月一发布,`master`分支稳定后,`merge`到`3.0`分支,并发布`release`版本。
- __[2.0](https://github.com/XCharts-Team/XCharts/tree/2.0)__ XCharts2.0的稳定分支。带Demo目前基本不再维护仅修改严重bug。
- __[2.0-upm](https://github.com/XCharts-Team/XCharts/tree/2.0-upm)__ XCharts2.0的稳定UMP分支。不带Demo只包含Package部分不再维护。
- __[1.0](https://github.com/XCharts-Team/XCharts/tree/1.0)__ XCharts1.0的稳定分支。带Demo不再维护。
- __[1.0-upm](https://github.com/XCharts-Team/XCharts/tree/1.0-upm)__ XCharts1.0的稳定UMP分支。不带Demo不再维护。
## 使用
@ -133,24 +124,31 @@
- 更多细节,请看[【XCharts教程5分钟上手教程】](Documentation~/zh/tutorial01.md)。
- 首次使用,建议先认真看一遍教程。
## 注意
- __XCharts3.0不完全兼容XCharts2.0版本。__ 升级`3.0`时,部分代码和配置可能需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。
- __XCharts2.0只维护不加新功能。__ `2.0`只修复严重`bug`,原则上不再加新功能。
- __XCharts支持Unity 5.6及以上版本。__ 但由于版本测试有限难免疏漏,发现问题可提`Issue`。
- __本仓库只包含XCharts源码不包含Demo示例部分。__ 需要查看`Demo`示例源码请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。也可以在浏览器查看运行效果 [在线Demo](https://xcharts-team.github.io/examples/) 。
## FAQ
- `XCharts`可以免费使用吗?
答:`XCharts`使用`MIT`协议,可以免费使用。也可以订阅`VIP`享受更多增值服务。
- __XCharts可以免费使用吗__
`XCharts`使用`MIT`协议,可以免费使用。也可以订阅`VIP`享受更多增值服务。
- `XCharts`支持代码动态添加和修改数据吗?支持从`Excel`或数据库中获取数据吗?
答:`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析和获取,再调用`XCharts`的接口添加到图表。
- __XCharts支持代码动态添加和修改数据吗支持从`Excel`或数据库中获取数据吗__
`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析和获取,再调用`XCharts`的接口添加到图表。
- `XCharts`除了用在`Unity`平台,还能用在`Winform`或`WPF`等平台吗?
答:`XCharts`只支持在`Unity`平台使用。理论上任何支持`UGUI`的`Unity`版本都能运行`XCharts`。
- __XCharts除了用在Unity平台还能用在Winform或WPF等平台吗__
`XCharts`只支持在`Unity`平台使用。理论上任何支持`UGUI`的`Unity`版本都能运行`XCharts`。
- 锯齿怎么解决?支持多大量级的数据?
答:`XCharts`是基于`UGUI`实现的,所以`UGUI`中碰到的问题,在`XCharts`中也会存在。比如锯齿问题,比如`Mesh`顶点数超`65535`的问题。这两个问题的解决可参考[问答16](Documentation~/zh/faq.md)和[问答27](Documentation~/zh/faq.md)。
由于`Mesh`的`65535`顶点数的限制,目前`XCharts`的单条`Line`支持约`2万`的数据量当然开启采样可以支持更多数据的绘制但同时也会更消耗CPU。
- __锯齿怎么解决?支持多大量级的数据?__
`XCharts`是基于`UGUI`实现的,所以`UGUI`中碰到的问题,在`XCharts`中也会存在。比如锯齿问题,比如`Mesh`顶点数超`65535`的问题。这两个问题的解决可参考[问答16](Documentation~/zh/faq.md)和[问答27](Documentation~/zh/faq.md)。
由于`Mesh`的`65535`顶点数的限制,目前`XCharts`的单条`Line`支持约`2万`的数据量当然开启采样可以支持更多数据的绘制但同时也会更消耗CPU。
## 日志
- [更新日志](Documentation~/zh/changelog.md)
- 各版本的详细更新日志请查看 [更新日志](Documentation~/zh/changelog.md)
## Licenses

View File

@ -50,4 +50,4 @@ MonoBehaviour:
- {fileID: 11400000, guid: e1dc23a10de1e4c5dbfbaf74c4dfd218, type: 2}
- {fileID: 11400000, guid: f917f38ce737f4563a377883dccaff8f, type: 2}
- {fileID: 11400000, guid: 376d15d5e9b694d75965c837a0fe1222, type: 2}
- {fileID: 11400000, guid: 53a3134197061f64697ca747d9fabdea, type: 2}
- {fileID: 11400000, guid: ca197cbcd2f864f4ebf54eb763e73cea, type: 2}

View File

@ -10,11 +10,11 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6c59330ca0f4443b69f06b890a44f32e, type: 3}
m_Name: XCTheme-Default_LineChart
m_Name: XCTheme-Custom
m_EditorClassIdentifier:
m_ThemeType: 3
m_ThemeName: Default
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_ContrastColor:
serializedVersion: 2
rgba: 0
@ -23,7 +23,7 @@ MonoBehaviour:
rgba: 16777215
m_ColorPalette:
- serializedVersion: 2
rgba: 2445715796
rgba: 4291194964
- serializedVersion: 2
rgba: 4285910161
- serializedVersion: 2
@ -41,28 +41,28 @@ MonoBehaviour:
- serializedVersion: 2
rgba: 4291591402
m_Common:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 20
m_Title:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 24
m_SubTitle:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.5882353, g: 0.5882353, b: 0.5882353, a: 1}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 22
m_Legend:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.31764707, g: 0.3019608, b: 0.3019608, a: 1}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 20
m_UnableColor: {r: 0.8, g: 0.8, b: 0.8, a: 1}
m_Axis:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18
@ -92,8 +92,8 @@ MonoBehaviour:
- serializedVersion: 2
rgba: 1305004232
m_Tooltip:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0, g: 0, b: 0, a: 1}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 1, g: 1, b: 1, a: 1}
m_FontSize: 20
m_LineType: 0
@ -109,10 +109,10 @@ MonoBehaviour:
rgba: 4294967295
m_LabelBackgroundColor:
serializedVersion: 2
rgba: 4280887593
rgba: 4294967295
m_DataZoom:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_TextColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 1, g: 1, b: 1, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 20
m_BorderWidth: 0.5
@ -133,7 +133,7 @@ MonoBehaviour:
serializedVersion: 2
rgba: 0
m_VisualMap:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Font: {fileID: 12800000, guid: e76d760b90909bc439340217554ba527, type: 3}
m_TextColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_TextBackgroundColor: {r: 0, g: 0, b: 0, a: 0}
m_FontSize: 18

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 53a3134197061f64697ca747d9fabdea
guid: ca197cbcd2f864f4ebf54eb763e73cea
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

View File

@ -22,7 +22,7 @@ namespace XCharts.Runtime
radiusAxis.axisLabel.show = false;
var tooltip = EnsureChartComponent<Tooltip>();
tooltip.type = Tooltip.Type.Corss;
tooltip.type = Tooltip.Type.Cross;
tooltip.trigger = Tooltip.Trigger.Axis;
RemoveData();

View File

@ -37,7 +37,7 @@ namespace XCharts.Runtime
animationType = attribute.type;
enableSerieDataAnimation = attribute.enableSerieDataAddedAnimation;
}
UpdateAnimationType(serie.animation, animationType,enableSerieDataAnimation);
UpdateAnimationType(serie.animation, animationType, enableSerieDataAnimation);
}
public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType, bool enableSerieDataAnimation)
@ -48,12 +48,12 @@ namespace XCharts.Runtime
animation.context.enableSerieDataAddedAnimation = enableSerieDataAnimation;
}
public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)
public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip, ref float rate)
{
if (animation.context.type == AnimationType.AlongPath)
{
var dist = Vector3.Distance(lp, cp);
var rate = (dist - animation.context.currentPathDistance + animation.GetCurrDetail()) / dist;
rate = (dist - animation.context.currentPathDistance + animation.GetCurrDetail()) / dist;
ip = Vector3.Lerp(lp, cp, rate);
return true;
}
@ -62,7 +62,15 @@ namespace XCharts.Runtime
var startPos = isY ? new Vector3(-10000, progress) : new Vector3(progress, -10000);
var endPos = isY ? new Vector3(10000, progress) : new Vector3(progress, 10000);
return UGLHelper.GetIntersection(lp, cp, startPos, endPos, ref ip);
if (UGLHelper.GetIntersection(lp, cp, startPos, endPos, ref ip))
{
rate = Vector3.Distance(lp, ip) / Vector3.Distance(lp, cp);
return true;
}
else
{
return false;
}
}
}
}

View File

@ -75,7 +75,8 @@ namespace XCharts.Runtime
Left,
Right,
Bottom,
Top
Top,
Center
}
[SerializeField] protected bool m_Show = true;
@ -98,6 +99,7 @@ namespace XCharts.Runtime
[SerializeField] protected bool m_Inverse = false;
[SerializeField] private bool m_Clockwise = true;
[SerializeField] private bool m_InsertDataToHead;
[SerializeField][Since("v3.11.0")] private float m_MinCategorySpacing = 0;
[SerializeField] protected List<Sprite> m_Icons = new List<Sprite>();
[SerializeField] protected List<string> m_Data = new List<string>();
[SerializeField] protected AxisLine m_AxisLine = AxisLine.defaultAxisLine;
@ -405,6 +407,15 @@ namespace XCharts.Runtime
get { return m_InsertDataToHead; }
set { if (PropertyUtil.SetStruct(ref m_InsertDataToHead, value)) SetAllDirty(); }
}
/// <summary>
/// The minimum spacing between categories.
/// ||类目之间的最小间距。
/// </summary>
public float minCategorySpacing
{
get { return m_MinCategorySpacing; }
set { if (PropertyUtil.SetStruct(ref m_MinCategorySpacing, value)) SetAllDirty(); }
}
public override bool vertsDirty
{
@ -458,6 +469,17 @@ namespace XCharts.Runtime
base.SetComponentDirty();
}
/// <summary>
/// 重置状态。
/// </summary>
public override void ResetStatus()
{
context.minValue = 0;
context.maxValue = 0;
context.destMinValue = 0;
context.destMaxValue = 0;
}
public Axis Clone()
{
var axis = new Axis();
@ -729,10 +751,14 @@ namespace XCharts.Runtime
/// <param name="value"></param>
/// <param name="axisLength"></param>
/// <returns></returns>
public float GetDistance(double value, float axisLength)
public float GetDistance(double value, float axisLength = 0)
{
if (context.minMaxRange == 0)
return 0;
if (axisLength == 0)
{
axisLength = context.length;
}
if (IsCategory() && boundaryGap)
{
@ -919,5 +945,43 @@ namespace XCharts.Runtime
(float)(Math.Abs(context.minValue) * (axisLength / (Math.Abs(context.minValue) + Math.Abs(context.maxValue))))
);
}
public Vector3 GetCategoryPosition(int categoryIndex, int dataCount = 0)
{
if (dataCount <= 0)
{
dataCount = data.Count;
}
if (IsCategory() && dataCount > 0)
{
Vector3 pos;
if (boundaryGap)
{
var each = context.length / dataCount;
pos = context.start + context.dire * (each * (categoryIndex + 0.5f));
}
else
{
var each = context.length / (dataCount - 1);
pos = context.start + context.dire * (each * categoryIndex);
}
if (axisLabel.distance != 0)
{
if (this is YAxis)
{
pos.x = GetLabelObjectPosition(0).x;
}
else
{
pos.y = GetLabelObjectPosition(0).y;
}
}
return pos;
}
else
{
return Vector3.zero;
}
}
}
}

View File

@ -0,0 +1,160 @@
using UnityEngine;
using UnityEngine.UI;
using XUGL;
namespace XCharts.Runtime
{
public static class Axis3DHelper
{
public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, ZAxis3D zAxis, double xValue, double yValue, double zValue)
{
var x = xAxis.GetDistance(xValue);
var y = yAxis.GetDistance(yValue);
var z = zAxis.GetDistance(zValue);
var dest = grid.context.pointA;
dest += xAxis.context.dire * x;
dest += yAxis.context.dire * y;
dest += zAxis.context.dire * z;
return dest;
}
public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, double xValue, double yValue)
{
var x = xAxis.GetDistance(xValue);
var y = yAxis.GetDistance(yValue);
var dest = grid.context.pointA;
dest += xAxis.context.dire * x;
dest += yAxis.context.dire * y;
return dest;
}
internal static void DrawAxisTick(VertexHelper vh, Axis axis, AxisTheme theme, DataZoom dataZoom,
Vector3 start, Vector3 end, Vector3 relativedDire)
{
var tickLength = axis.axisTick.GetLength(theme.tickLength);
var axisLength = Vector3.Distance(start, end);
var axisDire = (end - start).normalized;
if (axis.position == Axis.AxisPosition.Right)
{
relativedDire = -relativedDire;
}
if (AxisHelper.NeedShowSplit(axis))
{
var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
if (axis.IsTime())
{
size += 1;
if (!ChartHelper.IsEquals(axis.GetLastLabelValue(), axis.context.maxValue))
size += 1;
}
var tickWidth = axis.axisTick.GetWidth(theme.tickWidth);
var tickColor = axis.axisTick.GetColor(theme.tickColor);
var current = start;
for (int i = 0; i < size; i++)
{
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
var hideTick = (i == 0 && (!axis.axisTick.showStartTick || axis.axisTick.alignWithLabel)) ||
(i == size - 1 && !axis.axisTick.showEndTick);
if (axis.axisTick.show && !hideTick)
{
UGL.DrawLine(vh, current, current + relativedDire * tickLength, tickWidth, tickColor);
}
current += axisDire * scaleWidth;
}
}
if (axis.show && axis.axisLine.show && axis.axisLine.showArrow)
{
}
}
public static void DrawAxisSplit(VertexHelper vh, Axis axis, AxisTheme theme, DataZoom dataZoom,
Vector3 start, Vector3 end, Axis relativedAxis)
{
if (relativedAxis == null) return;
var axisLength = Vector3.Distance(start, end);
var axisDire = (end - start).normalized;
var splitLength = relativedAxis.context.length;
var relativeDire = relativedAxis.context.dire;
var axisLineWidth = axis.axisLine.GetWidth(theme.lineWidth);
splitLength -= axisLineWidth;
var lineColor = axis.splitLine.GetColor(theme.splitLineColor);
var lineWidth = axis.splitLine.GetWidth(theme.lineWidth);
var lineType = axis.splitLine.GetType(theme.splitLineType);
var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
if (axis.IsTime())
{
size += 1;
if (!ChartHelper.IsEquals(axis.GetLastLabelValue(), axis.context.maxValue))
size += 1;
}
var current = start;
for (int i = 0; i < size; i++)
{
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);
if (axis.boundaryGap && axis.axisTick.alignWithLabel)
current -= axisDire * scaleWidth / 2;
if (axis.splitArea.show && i <= size - 1)
{
var p1 = current;
var p2 = current + relativeDire * splitLength;
var p3 = p2 + axisDire * scaleWidth;
var p4 = p1 + axisDire * scaleWidth;
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, axis.splitArea.GetColor(i, theme));
}
if (axis.splitLine.show)
{
if (axis.splitLine.NeedShow(i, size))
{
if (relativedAxis == null || !relativedAxis.axisLine.show
|| (Vector3.Distance(current, relativedAxis.context.start) > 0.5f && Vector3.Distance(current, relativedAxis.context.end) > 0.5f))
{
ChartDrawer.DrawLineStyle(vh,
lineType,
lineWidth,
current,
current + relativeDire * splitLength,
lineColor);
}
}
}
current += axisDire * scaleWidth;
}
}
public static Vector3 GetLabelPosition(int i, Axis axis, Axis relativedAxis, AxisTheme theme, float scaleWid)
{
var axisStart = axis.context.start;
var axisEnd = axis.context.end;
var axisDire = axis.context.dire;
var relativedDire = relativedAxis != null ? relativedAxis.context.dire : Vector3.zero;
var axisLength = Vector3.Distance(axisStart, axisEnd);
var inside = axis.axisLabel.inside;
var fontSize = axis.axisLabel.textStyle.GetFontSize(theme);
var current = axis.offset;
if (axis.position == Axis.AxisPosition.Right)
{
relativedDire = -relativedDire;
}
if (axis.IsTime() || axis.IsValue())
{
scaleWid = axis.context.minMaxRange != 0 ?
axis.GetDistance(axis.GetLabelValue(i), axisLength) :
0;
}
return axisStart + axisDire * scaleWid + axis.axisLabel.offset - relativedDire * (axis.axisLabel.distance + fontSize / 2);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52469636872044a81a291bb00b71a140
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,6 +15,9 @@ namespace XCharts.Runtime
/// 坐标轴的起点Y
/// </summary>
public float y;
public Vector3 start;
public Vector3 end;
public Vector3 dire;
/// <summary>
/// 坐标轴原点X
/// </summary>
@ -25,6 +28,7 @@ namespace XCharts.Runtime
public float zeroY;
public float width;
public float height;
public float length;
public Vector3 position;
public float left;
public float right;

View File

@ -58,7 +58,7 @@ namespace XCharts
(!axis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
{
axis.context.pointerValue = j;
axis.context.pointerLabelPosition = axis.GetLabelObjectPosition(j);
axis.context.pointerLabelPosition = axis.GetCategoryPosition(j, dataCount);
if (j != lastPointerValue)
{
if (chart.onAxisPointerValueChanged != null)
@ -78,7 +78,7 @@ namespace XCharts
(!axis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
{
axis.context.pointerValue = j;
axis.context.pointerLabelPosition = axis.GetLabelObjectPosition(j);
axis.context.pointerLabelPosition = axis.GetCategoryPosition(j, dataCount);
if (j != lastPointerValue)
{
if (chart.onAxisPointerValueChanged != null)
@ -147,7 +147,7 @@ namespace XCharts
if (axis.IsCategory())
{
axis.context.minValue = 0;
axis.context.maxValue = SeriesHelper.GetMaxSerieDataCount(chart.series) - 1;
axis.context.maxValue = axis.data.Count > 0 ? axis.data.Count - 1 : SeriesHelper.GetMaxSerieDataCount(chart.series) - 1;
axis.context.minMaxRange = axis.context.maxValue;
return;
}
@ -369,6 +369,115 @@ namespace XCharts
}
}
protected void InitAxis3D(Axis relativedAxis, Orient orient)
{
Axis axis = component;
var axisLength = (axis.context.end - axis.context.start).magnitude;
if (axisLength == 0) return;
chart.InitAxisRuntimeData(axis);
var objName = ChartCached.GetComponentObjectName(axis);
var axisObj = ChartHelper.AddObject(objName,
chart.transform,
chart.chartMinAnchor,
chart.chartMaxAnchor,
chart.chartPivot,
chart.chartSizeDelta);
axisObj.SetActive(axis.show);
axisObj.hideFlags = chart.chartHideFlags;
ChartHelper.HideAllObject(axisObj);
axis.gameObject = axisObj;
axis.context.labelObjectList.Clear();
if (!axis.show)
return;
var axisLabelTextStyle = axis.axisLabel.textStyle;
var dataZoom = chart.GetDataZoomOfAxis(axis);
var splitNumber = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
var totalWidth = 0f;
var eachWidth = AxisHelper.GetEachWidth(axis, axisLength, dataZoom);
var gapWidth = axis.boundaryGap ? eachWidth / 2 : 0;
var textWidth = axis.axisLabel.width > 0 ?
axis.axisLabel.width :
AxisHelper.GetScaleWidth(axis, axisLength, 0, dataZoom);
var textHeight = axis.axisLabel.height > 0 ?
axis.axisLabel.height :
20f;
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
var inside = axis.axisLabel.inside;
var defaultAlignment = orient == Orient.Horizonal ? TextAnchor.MiddleCenter :
((inside && axis.IsLeft()) || (!inside && axis.IsRight()) ?
TextAnchor.MiddleLeft :
TextAnchor.MiddleRight);
if (axis.IsCategory() && axis.boundaryGap)
splitNumber -= 1;
axis.context.aligment = defaultAlignment;
for (int i = 0; i < splitNumber; i++)
{
var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
var labelName = AxisHelper.GetLabelName(axis, axisLength, i,
axis.context.destMinValue,
axis.context.destMaxValue,
dataZoom, isPercentStack);
var label = ChartHelper.AddAxisLabelObject(splitNumber, i,
ChartCached.GetAxisLabelName(i),
axisObj.transform,
new Vector2(textWidth, textHeight),
axis, chart.theme.axis, labelName,
Color.clear,
defaultAlignment,
chart.theme.GetColor(i));
if (i == 0)
axis.axisLabel.SetRelatedText(label.text, labelWidth);
var pos = GetLabelPosition(totalWidth + gapWidth, i);
label.SetPosition(pos);
axis.context.labelObjectList.Add(label);
totalWidth += labelWidth;
}
if (axis.axisName.show)
{
ChartLabel label = null;
var offset = axis.axisName.labelStyle.offset;
var autoColor = axis.axisLine.GetColor(chart.theme.axis.lineColor);
switch (axis.axisName.labelStyle.position)
{
case LabelStyle.Position.Start:
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.context.start + offset);
break;
case LabelStyle.Position.Middle:
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition((axis.context.start + axis.context.end) / 2 + offset);
break;
default:
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
label.SetActive(axis.axisName.labelStyle.show);
label.SetPosition(axis.context.end + offset);
break;
}
}
}
protected void InitAxis(Axis relativedAxis, Orient orient,
float axisStartX, float axisStartY, float axisLength, float relativedLength)
{

View File

@ -65,7 +65,10 @@ namespace XCharts.Runtime
if (axis.splitNumber <= 0)
{
var eachWid = coordinateWid / dataCount;
var min = axis is YAxis ? 20 : 80;
var min = axis.minCategorySpacing > 0
? axis.minCategorySpacing
: (Mathf.Abs(axis.context.dire.y) < 0.01 ? 80 : 20);
if (eachWid > min) return dataCount;
var tick = Mathf.CeilToInt(min / eachWid);
return tick <= 1 ? dataCount : (int)(dataCount / tick);

View File

@ -15,6 +15,7 @@ namespace XCharts.Runtime
[SerializeField] private bool m_AutoColor;
[SerializeField][Since("v3.3.0")] private bool m_ShowStartLine = true;
[SerializeField][Since("v3.3.0")] private bool m_ShowEndLine = true;
[SerializeField][Since("v3.11.0")] private bool m_ShowZLine = true;
/// <summary>
/// The distance between the split line and axis line.
@ -53,6 +54,15 @@ namespace XCharts.Runtime
get { return m_ShowEndLine; }
set { if (PropertyUtil.SetStruct(ref m_ShowEndLine, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether to show the Z axis part of the split line. Generally used for 3D coordinate systems.
/// ||是否显示Z轴部分分割线。一般用于3D坐标系。
/// </summary>
public bool showZLine
{
get { return m_ShowZLine; }
set { if (PropertyUtil.SetStruct(ref m_ShowZLine, value)) SetVerticesDirty(); }
}
public override bool vertsDirty { get { return m_VertsDirty || m_LineStyle.anyDirty; } }
public override void ClearVerticesDirty()

View File

@ -45,6 +45,7 @@ namespace XCharts.Runtime
axis.context.x = parallel.context.x;
axis.context.y = parallel.context.y + (axis.index) * each;
axis.context.width = parallel.context.width;
axis.context.length = parallel.context.width;
}
else
{
@ -52,6 +53,7 @@ namespace XCharts.Runtime
axis.context.x = parallel.context.x + (axis.index) * each;
axis.context.y = parallel.context.y;
axis.context.width = parallel.context.height;
axis.context.length = parallel.context.height;
}
axis.context.orient = m_Orient;
axis.context.height = 0;

View File

@ -123,6 +123,12 @@ namespace XCharts.Runtime
else
context.y = chartY + context.bottom;
context.start = new Vector3(context.x, context.y);
if (m_Orient == Orient.Horizonal)
context.end = new Vector3(context.x + context.width, context.y);
else
context.end = new Vector3(context.x, context.y + context.height);
context.length = (context.end - context.start).magnitude;
context.position = new Vector3(context.x, context.y);
}

View File

@ -1,5 +1,6 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace XCharts.Runtime
{
@ -16,7 +17,28 @@ namespace XCharts.Runtime
public override void Update()
{
UpdateAxisMinMaxValue(component.index, component);
UpdatePointerValue(component);
if (!chart.isTriggerOnClick)
{
UpdatePointerValue(component);
}
}
public override void OnPointerClick(PointerEventData eventData)
{
base.OnPointerClick(eventData);
if (chart.isTriggerOnClick)
{
UpdatePointerValue(component);
}
}
public override void OnPointerExit(PointerEventData eventData)
{
base.OnPointerExit(eventData);
if (chart.isTriggerOnClick)
{
component.context.pointerValue = double.PositiveInfinity;
}
}
public override void DrawBase(VertexHelper vh)
@ -35,6 +57,11 @@ namespace XCharts.Runtime
var relativedAxis = chart.GetChartComponent<YAxis>(axis.gridIndex);
axis.context.x = grid.context.x;
axis.context.y = AxisHelper.GetXAxisXOrY(grid, axis, relativedAxis);
axis.context.start = new Vector3(grid.context.x, axis.context.y);
axis.context.end = new Vector3(grid.context.x + grid.context.width, axis.context.y);
var vec = axis.context.end - axis.context.start;
axis.context.dire = vec.normalized;
axis.context.length = vec.magnitude;
axis.context.zeroY = grid.context.y;
axis.context.zeroX = grid.context.x + axis.context.offset;
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6350e9983955e49c5b48704d3866cbfe
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// ||直角坐标系 grid 中的 x 轴。
/// </summary>
[Since("v3.11.0")]
[System.Serializable]
[RequireChartComponent(typeof(GridCoord3D))]
[ComponentHandler(typeof(XAxis3DHander), true)]
public class XAxis3D : Axis
{
public override void SetDefaultValue()
{
m_Show = true;
m_Type = AxisType.Category;
m_Min = 0;
m_Max = 0;
m_SplitNumber = 0;
m_BoundaryGap = true;
m_Position = AxisPosition.Bottom;
m_Offset = 0;
m_Data = new List<string>() { "x1", "x2", "x3", "x4", "x5" };
m_Icons = new List<Sprite>(5);
splitLine.show = false;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = true;
axisName.name = "X";
axisName.labelStyle.position = LabelStyle.Position.Middle;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9129bca9c2a864e1ea337d7eb74d1024
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,190 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace XCharts.Runtime
{
[UnityEngine.Scripting.Preserve]
internal sealed class XAxis3DHander : AxisHandler<XAxis3D>
{
protected override Orient orient { get { return Orient.Horizonal; } }
public override void InitComponent()
{
InitXAxis(component);
}
public override void Update()
{
UpdateAxisMinMaxValue(component.index, component);
if (!chart.isTriggerOnClick)
{
UpdatePointerValue(component);
}
}
public override void OnPointerClick(PointerEventData eventData)
{
base.OnPointerClick(eventData);
if (chart.isTriggerOnClick)
{
UpdatePointerValue(component);
}
}
public override void OnPointerExit(PointerEventData eventData)
{
base.OnPointerExit(eventData);
if (chart.isTriggerOnClick)
{
component.context.pointerValue = double.PositiveInfinity;
}
}
public override void DrawBase(VertexHelper vh)
{
UpdatePosition(component);
DrawXAxisSplit(vh, component);
DrawXAxisLine(vh, component);
DrawXAxisTick(vh, component);
}
private void UpdatePosition(XAxis3D axis)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid != null)
{
if (axis.position == Axis.AxisPosition.Right || axis.position == Axis.AxisPosition.Top)
{
axis.context.start = grid.xyExchanged ? grid.context.pointD : grid.context.pointB;
axis.context.end = grid.context.pointC;
}
else
{
axis.context.start = grid.context.pointA;
axis.context.end = grid.xyExchanged ? grid.context.pointB : grid.context.pointD;
}
var vect = axis.context.end - axis.context.start;
axis.context.x = axis.context.start.x;
axis.context.y = axis.context.start.y;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
}
}
private void InitXAxis(XAxis3D xAxis)
{
var theme = chart.theme;
var xAxisIndex = xAxis.index;
xAxis.painter = chart.painter;
xAxis.refreshComponent = delegate ()
{
var yAxis = chart.GetChartComponent<YAxis3D>(xAxis.index);
InitAxis3D(yAxis, orient);
};
xAxis.refreshComponent();
}
internal override void UpdateAxisLabelText(Axis axis)
{
base.UpdateAxisLabelText(axis);
if (axis.IsTime() || axis.IsValue())
{
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
{
var label = axis.context.labelObjectList[i];
if (label != null)
{
var pos = GetLabelPosition(0, i);
label.SetPosition(pos);
CheckValueLabelActive(component, i, label, pos);
}
}
}
}
protected override Vector3 GetLabelPosition(float scaleWid, int i)
{
var yAxis = chart.GetChartComponent<YAxis3D>(component.index);
return Axis3DHelper.GetLabelPosition(i, component, yAxis, chart.theme.axis, scaleWid);
}
private void DrawXAxisSplit(VertexHelper vh, XAxis3D xAxis)
{
if (AxisHelper.NeedShowSplit(xAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(xAxis.gridIndex);
var relativedAxis = chart.GetChartComponent<YAxis3D>(xAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
var isLeft = grid.IsLeft();
if (grid.xyExchanged)
{
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointB,
relativedAxis);
if (xAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(xAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointC : grid.context.pointB,
relativedAxis2);
}
}
else
{
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointD,
relativedAxis);
if (xAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(xAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
grid.context.pointB,
grid.context.pointC,
relativedAxis2);
}
}
}
}
private void DrawXAxisTick(VertexHelper vh, XAxis3D xAxis)
{
if (AxisHelper.NeedShowSplit(xAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(xAxis.gridIndex);
if (grid == null)
return;
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
var relativedAxis = chart.GetChartComponent<YAxis3D>(xAxis.gridIndex);
Axis3DHelper.DrawAxisTick(vh, xAxis, chart.theme.axis, dataZoom,
xAxis.context.start,
xAxis.context.end,
-relativedAxis.context.dire);
}
}
private void DrawXAxisLine(VertexHelper vh, XAxis3D axis)
{
if (axis.show && axis.axisLine.show)
{
var theme = chart.theme.axis;
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
var lineType = axis.axisLine.GetType(theme.lineType);
var lineColor = axis.axisLine.GetColor(theme.lineColor);
var start = axis.context.start;
var end = axis.context.end;
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
}
}
internal override float GetAxisLineXOrY()
{
return component.context.y;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc1147481a423494d963df29b423f3a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -35,6 +35,11 @@ namespace XCharts.Runtime
var relativedAxis = chart.GetChartComponent<XAxis>(axis.gridIndex);
axis.context.x = AxisHelper.GetYAxisXOrY(grid, axis, relativedAxis);
axis.context.y = grid.context.y;
axis.context.start = new Vector3(axis.context.x, grid.context.y);
axis.context.end = new Vector3(axis.context.x, grid.context.y + grid.context.height);
var vect = axis.context.end - axis.context.start;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
axis.context.zeroX = axis.context.x;
axis.context.zeroY = axis.context.y + axis.context.offset;
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aa26616789b6b4903aae479a4c552b89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
using System.Collections.Generic;
namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// ||直角坐标系 grid 中的 y 轴。
/// </summary>
[Since("v3.11.0")]
[System.Serializable]
[RequireChartComponent(typeof(GridCoord3D), typeof(XAxis3D))]
[ComponentHandler(typeof(YAxis3DHander), true)]
public class YAxis3D : Axis
{
public override void SetDefaultValue()
{
m_Show = true;
m_Type = AxisType.Value;
m_Min = 0;
m_Max = 0;
m_SplitNumber = 0;
m_BoundaryGap = false;
m_Position = AxisPosition.Left;
m_Data = new List<string>(5);
splitLine.show = true;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = false;
axisTick.showStartTick = true;
axisName.name = "Y";
axisName.labelStyle.position = LabelStyle.Position.Middle;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a3cb4a6657aaf473bbae7162eb189cc0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,176 @@
using UnityEngine;
using UnityEngine.UI;
namespace XCharts.Runtime
{
[UnityEngine.Scripting.Preserve]
internal sealed class YAxis3DHander : AxisHandler<YAxis3D>
{
protected override Orient orient { get { return Orient.Vertical; } }
public override void InitComponent()
{
InitYAxis(component);
}
public override void Update()
{
UpdateAxisMinMaxValue(component.index, component);
UpdatePointerValue(component);
}
public override void DrawBase(VertexHelper vh)
{
UpdatePosition(component);
DrawYAxisSplit(vh, component.index, component);
DrawYAxisLine(vh, component.index, component);
DrawYAxisTick(vh, component.index, component);
}
private void UpdatePosition(YAxis3D axis)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid != null)
{
if (axis.position == Axis.AxisPosition.Right)
{
axis.context.start = grid.xyExchanged ? grid.context.pointB : grid.context.pointD;
axis.context.end = grid.context.pointC;
}
else
{
axis.context.start = grid.context.pointA;
axis.context.end = grid.xyExchanged ? grid.context.pointD : grid.context.pointB;
}
axis.context.x = axis.context.start.x;
axis.context.y = axis.context.start.y;
var vect = axis.context.end - axis.context.start;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
}
}
private void InitYAxis(YAxis3D yAxis)
{
var theme = chart.theme;
var yAxisIndex = yAxis.index;
yAxis.painter = chart.painter;
yAxis.refreshComponent = delegate ()
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid != null)
{
var xAxis = chart.GetChartComponent<YAxis3D>(yAxis.index);
InitAxis3D(xAxis, orient);
}
};
yAxis.refreshComponent();
}
internal override void UpdateAxisLabelText(Axis axis)
{
base.UpdateAxisLabelText(axis);
if (axis.IsTime() || axis.IsValue())
{
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
{
var label = axis.context.labelObjectList[i];
if (label != null)
{
var pos = GetLabelPosition(0, i);
label.SetPosition(pos);
CheckValueLabelActive(axis, i, label, pos);
}
}
}
}
protected override Vector3 GetLabelPosition(float scaleWid, int i)
{
var xAxis = chart.GetChartComponent<XAxis3D>(component.index);
return Axis3DHelper.GetLabelPosition(i, component, xAxis, chart.theme.axis, scaleWid);
}
private void DrawYAxisSplit(VertexHelper vh, int yAxisIndex, YAxis3D yAxis)
{
if (AxisHelper.NeedShowSplit(yAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
var isLeft = grid.IsLeft();
if (grid.xyExchanged)
{
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointD,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointB, grid.context.pointC, relativedAxis2);
}
}
else
{
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointB,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointC : grid.context.pointB,
relativedAxis2);
}
}
}
}
private void DrawYAxisTick(VertexHelper vh, int yAxisIndex, YAxis3D yAxis)
{
if (AxisHelper.NeedShowSplit(yAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid == null)
return;
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisTick(vh, yAxis, chart.theme.axis, dataZoom,
yAxis.context.start,
yAxis.context.end,
-relativedAxis.context.dire);
}
}
private void DrawYAxisLine(VertexHelper vh, int axisIndex, YAxis3D axis)
{
if (axis.show && axis.axisLine.show)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid == null)
return;
var theme = chart.theme.axis;
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
var lineType = axis.axisLine.GetType(theme.lineType);
var lineColor = axis.axisLine.GetColor(theme.lineColor);
var start = axis.context.start;
var end = axis.context.end;
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
}
}
internal override float GetAxisLineXOrY()
{
return component.context.x;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56b4be734c61645e1bf91c22a6e3da6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 378448672ed084b0798c7ad343314693
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
using System.Collections.Generic;
namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// ||直角坐标系 grid 中的 y 轴。
/// </summary>
[Since("v3.11.0")]
[System.Serializable]
[RequireChartComponent(typeof(GridCoord3D), typeof(XAxis3D))]
[ComponentHandler(typeof(ZAxis3DHander), true)]
public class ZAxis3D : Axis
{
public override void SetDefaultValue()
{
m_Show = true;
m_Type = AxisType.Value;
m_Min = 0;
m_Max = 0;
m_SplitNumber = 0;
m_BoundaryGap = false;
m_Position = AxisPosition.Left;
m_Data = new List<string>(5);
splitLine.show = true;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = false;
axisTick.showStartTick = true;
axisName.name = "Z";
axisName.labelStyle.position = LabelStyle.Position.Middle;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 65aa8ae88610c431ebdab86935af2379
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,198 @@
using UnityEngine;
using UnityEngine.UI;
namespace XCharts.Runtime
{
[UnityEngine.Scripting.Preserve]
internal sealed class ZAxis3DHander : AxisHandler<ZAxis3D>
{
protected override Orient orient { get { return Orient.Vertical; } }
public override void InitComponent()
{
InitYAxis(component);
}
public override void Update()
{
UpdateAxisMinMaxValue(component.index, component);
UpdatePointerValue(component);
}
public override void DrawBase(VertexHelper vh)
{
UpdatePosition(component);
DrawZAxisSplit(vh, component.index, component);
DrawZAxisLine(vh, component.index, component);
DrawZAxisTick(vh, component.index, component);
}
private void UpdatePosition(ZAxis3D axis)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid != null)
{
if (grid.context.pointB.x < grid.context.pointA.x)
{
axis.context.start = grid.context.pointD;
axis.context.end = grid.context.pointH;
}
else if (axis.position == Axis.AxisPosition.Center)
{
axis.context.start = grid.context.pointB;
axis.context.end = grid.context.pointF;
}
else if (axis.position == Axis.AxisPosition.Right)
{
axis.context.start = grid.context.pointC;
axis.context.end = grid.context.pointG;
}
else
{
axis.context.start = grid.context.pointA;
axis.context.end = grid.context.pointE;
}
axis.context.x = axis.context.start.x;
axis.context.y = axis.context.start.y;
var vect = axis.context.end - axis.context.start;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
}
}
private void InitYAxis(ZAxis3D yAxis)
{
var theme = chart.theme;
var yAxisIndex = yAxis.index;
yAxis.painter = chart.painter;
yAxis.refreshComponent = delegate ()
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid != null)
{
var relativedAxis = chart.GetChartComponent<ZAxis3D>(yAxis.index);
InitAxis3D(relativedAxis, orient);
}
};
yAxis.refreshComponent();
}
internal override void UpdateAxisLabelText(Axis axis)
{
base.UpdateAxisLabelText(axis);
if (axis.IsTime() || axis.IsValue())
{
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
{
var label = axis.context.labelObjectList[i];
if (label != null)
{
var pos = GetLabelPosition(0, i);
label.SetPosition(pos);
CheckValueLabelActive(axis, i, label, pos);
}
}
}
}
protected override Vector3 GetLabelPosition(float scaleWid, int i)
{
var grid = chart.GetChartComponent<GridCoord3D>(component.gridIndex);
if (grid == null)
return Vector3.zero;
var yAxis = chart.GetChartComponent<XAxis3D>(component.index);
return Axis3DHelper.GetLabelPosition(i, component, yAxis,
chart.theme.axis,
scaleWid);
}
private void DrawZAxisSplit(VertexHelper vh, int yAxisIndex, ZAxis3D yAxis)
{
if (AxisHelper.NeedShowSplit(yAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid == null)
return;
var isLeft = grid.IsLeft();
if (grid.xyExchanged)
{
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointH : grid.context.pointE,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<YAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointB,
grid.context.pointF,
relativedAxis2);
}
}
else
{
var relativedAxis = chart.GetChartComponent<YAxis3D>(yAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointH : grid.context.pointE,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointB,
grid.context.pointF,
relativedAxis2);
}
}
}
}
private void DrawZAxisTick(VertexHelper vh, int yAxisIndex, ZAxis3D zAxis)
{
if (AxisHelper.NeedShowSplit(zAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(zAxis.gridIndex);
if (grid == null)
return;
var dataZoom = chart.GetDataZoomOfAxis(zAxis);
var relativedDire = grid.context.pointA - grid.context.pointB;
Axis3DHelper.DrawAxisTick(vh, zAxis, chart.theme.axis, dataZoom,
zAxis.context.start,
zAxis.context.end,
relativedDire.normalized);
}
}
private void DrawZAxisLine(VertexHelper vh, int axisIndex, ZAxis3D axis)
{
if (axis.show && axis.axisLine.show)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid == null)
return;
var theme = chart.theme.axis;
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
var lineType = axis.axisLine.GetType(theme.lineType);
var lineColor = axis.axisLine.GetColor(theme.lineColor);
var start = axis.context.start;
var end = axis.context.end;
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
}
}
internal override float GetAxisLineXOrY()
{
return component.context.x;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 67fb4be32885d4915979719c676aac5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -37,7 +37,7 @@ namespace XCharts.Runtime
/// crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.
/// ||十字准星指示器。坐标轴显示Label和交叉线。
/// </summary>
Corss,
Cross,
/// <summary>
/// Auto select indicator according to serie type.
/// ||根据serie的类型自动选择显示指示器。
@ -73,6 +73,23 @@ namespace XCharts.Runtime
Auto
}
/// <summary>
/// the condition of trigger tooltip.
/// ||触发条件。
/// </summary>
public enum TriggerOn
{
/// <summary>
/// Trigger when mouse move.
/// ||鼠标移动时触发。
/// </summary>
MouseMove,
/// <summary>
/// Trigger when mouse click.
/// ||鼠标点击时触发。
/// </summary>
Click,
}
/// <summary>
/// Position type.
/// ||坐标类型。
/// </summary>
@ -102,6 +119,7 @@ namespace XCharts.Runtime
[SerializeField] private bool m_Show = true;
[SerializeField] private Type m_Type = Type.Auto;
[SerializeField] private Trigger m_Trigger = Trigger.Auto;
[SerializeField][Since("v3.11.0")] private TriggerOn m_TriggerOn = TriggerOn.MouseMove;
[SerializeField][Since("v3.3.0")] private Position m_Position = Position.Auto;
[SerializeField] private string m_ItemFormatter;
[SerializeField] private string m_TitleFormatter;
@ -144,6 +162,12 @@ namespace XCharts.Runtime
public TooltipContext context = new TooltipContext();
public TooltipView view;
/// <summary>
/// the callback of tooltip click index.
/// ||Tooltip为Click触发时点击的X轴索引的回调。
/// </summary>
public System.Action<int> onClickIndex { get; set; }
/// <summary>
/// Whether to show the tooltip component.
/// ||是否显示提示框组件。
@ -172,6 +196,15 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetStruct(ref m_Trigger, value)) SetAllDirty(); }
}
/// <summary>
/// Condition of trigger tooltip.
/// ||触发条件。
/// </summary>
public TriggerOn triggerOn
{
get { return m_TriggerOn; }
set { if (PropertyUtil.SetStruct(ref m_TriggerOn, value)) SetAllDirty(); }
}
/// <summary>
/// Type of position.
/// ||显示位置类型。
/// </summary>
@ -211,7 +244,7 @@ namespace XCharts.Runtime
/// {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/>
/// {f}为数据总和。<br/>
/// {g}为数据总个数。<br/>
/// {f}为value所对应的y轴的类目值。<br/>
/// {y}为value所对应的y轴的类目值。<br/>
/// {.1}表示指定index为1的serie对应颜色的圆点。<br/>
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/>
/// {c1:2}表示索引为1的serie的当前指示数据项的第3个数据一个数据项有多个数据index为2表示第3个数据。<br/>

View File

@ -19,6 +19,7 @@ namespace XCharts.Runtime
public float width;
public float height;
public float angle;
public int xAxisClickIndex = -1;
public Tooltip.Type type;
public Tooltip.Trigger trigger;
public TooltipData data = new TooltipData();

View File

@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using XUGL;
@ -36,6 +37,15 @@ namespace XCharts.Runtime
DrawTooltipIndicator(vh, component);
}
public override void OnPointerExit(PointerEventData eventData)
{
base.OnPointerExit(eventData);
if (chart.isTriggerOnClick)
{
component.context.xAxisClickIndex = -1;
}
}
private void InitTooltip(Tooltip tooltip)
{
tooltip.painter = chart.m_PainterUpper;
@ -55,6 +65,7 @@ namespace XCharts.Runtime
m_LabelRoot = ChartHelper.AddObject("label", tooltip.gameObject.transform, chart.chartMinAnchor,
chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
m_LabelRoot.transform.SetSiblingIndex(0);
ChartHelper.HideAllObject(m_LabelRoot);
m_IndicatorLabels.Clear();
foreach (var com in chart.components)
@ -70,6 +81,7 @@ namespace XCharts.Runtime
m_IndicatorLabels[labelName] = item;
}
}
chart.isTriggerOnClick = tooltip.triggerOn == Tooltip.TriggerOn.Click;
};
tooltip.refreshComponent();
}
@ -93,39 +105,57 @@ namespace XCharts.Runtime
private void UpdateTooltipData(Tooltip tooltip)
{
showTooltip = false;
m_ShowTooltip = false;
if (tooltip.trigger == Tooltip.Trigger.None) return;
if (chart.isPointerInChart && tooltip.show)
chart.isTriggerOnClick = tooltip.triggerOn == Tooltip.TriggerOn.Click;
if ((tooltip.show && chart.isPointerInChart) &&
((tooltip.triggerOn == Tooltip.TriggerOn.Click && chart.isPointerClick) ||
(tooltip.triggerOn == Tooltip.TriggerOn.MouseMove))
)
{
for (int i = chart.series.Count - 1; i >= 0; i--)
{
var serie = chart.series[i];
if (!(serie is INeedSerieContainer))
{
showTooltip = true;
containerSeries = null;
m_ShowTooltip = true;
m_ContainerSeries = null;
return;
}
}
containerSeries = ListPool<Serie>.Get();
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref containerSeries);
if (containerSeries.Count > 0)
m_ContainerSeries = ListPool<Serie>.Get();
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref m_ContainerSeries);
if (m_ContainerSeries.Count > 0)
{
showTooltip = true;
m_ShowTooltip = true;
return;
}
}
if (!showTooltip && tooltip.IsActive())
if (!m_ShowTooltip && tooltip.IsActive())
{
tooltip.ClearValue();
tooltip.SetActive(false);
component.context.xAxisClickIndex = -1;
chart.pointerClickEventData = null;
}
}
private bool showTooltip;
private List<Serie> containerSeries;
private bool m_ShowTooltip;
private List<Serie> m_ContainerSeries;
private void UpdateTooltip(Tooltip tooltip)
{
if (!showTooltip) return;
if (!m_ShowTooltip)
{
if (m_ContainerSeries != null)
{
ListPool<Serie>.Release(m_ContainerSeries);
m_ContainerSeries = null;
}
return;
}
var anyTrigger = false;
for (int i = chart.series.Count - 1; i >= 0; i--)
{
@ -140,24 +170,33 @@ namespace XCharts.Runtime
}
}
}
if (containerSeries != null)
if (!anyTrigger && m_ContainerSeries == null)
{
if (!SetSerieTooltip(tooltip, containerSeries))
showTooltip = false;
m_ContainerSeries = ListPool<Serie>.Get();
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref m_ContainerSeries);
}
if (m_ContainerSeries != null)
{
if (!SetSerieTooltip(tooltip, m_ContainerSeries))
m_ShowTooltip = false;
else
anyTrigger = true;
ListPool<Serie>.Release(containerSeries);
ListPool<Serie>.Release(m_ContainerSeries);
m_ContainerSeries = null;
}
if (!showTooltip || !anyTrigger)
if (!m_ShowTooltip || !anyTrigger)
{
if (tooltip.context.type == Tooltip.Type.Corss && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
if (tooltip.context.type == Tooltip.Type.Cross && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
{
m_ShowTooltip = true;
tooltip.SetActive(true);
tooltip.SetContentActive(false);
}
else
{
m_ShowTooltip = false;
tooltip.SetActive(false);
chart.pointerClickEventData = null;
}
}
else
@ -172,7 +211,7 @@ namespace XCharts.Runtime
if (tooltip.context.type == Tooltip.Type.None) return;
if (m_PointerContainer != null)
{
if (tooltip.context.type == Tooltip.Type.Corss)
if (tooltip.context.type == Tooltip.Type.Cross)
{
if (m_PointerContainer is GridCoord)
{
@ -223,7 +262,8 @@ namespace XCharts.Runtime
if (axis.IsCategory())
{
var index = (int)axis.context.pointerValue;
var category = axis.GetData(index);
var dataZoom = chart.GetDataZoomOfAxis(axis);
var category = axis.GetData(index, dataZoom);
label.SetText(axis.indicatorLabel.GetFormatterContent(index, category));
}
else if (axis.IsTime())
@ -274,20 +314,26 @@ namespace XCharts.Runtime
serie.context.tooltipTrigger : tooltip.trigger;
}
var isTriggerAxis = tooltip.IsTriggerAxis();
var inchart = true;
if (container is GridCoord)
{
var xAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
var yAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
UpdateAxisPointerDataIndex(serie, xAxis, yAxis, container as GridCoord, isTriggerAxis);
inchart = UpdateAxisPointerDataIndex(serie, xAxis, yAxis, container as GridCoord, isTriggerAxis);
}
else if (container is PolarCoord)
{
var m_AngleAxis = ComponentHelper.GetAngleAxis(chart.components, container.index);
tooltip.context.angle = (float)m_AngleAxis.context.pointerValue;
}
list.Add(serie);
if (!isTriggerAxis)
chart.RefreshTopPainter();
if (inchart)
{
list.Add(serie);
if (!isTriggerAxis)
{
chart.RefreshTopPainter();
}
}
}
}
m_PointerContainer = container;
@ -296,10 +342,11 @@ namespace XCharts.Runtime
}
}
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
private bool UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
{
serie.context.pointerAxisDataIndexs.Clear();
if (xAxis == null || yAxis == null) return;
if (xAxis == null || yAxis == null) return false;
var flag = true;
if (serie is Heatmap)
{
GetSerieDataByXYAxis(serie, xAxis, yAxis);
@ -328,20 +375,45 @@ namespace XCharts.Runtime
if (isTriggerAxis)
{
var index = serie.context.dataZoomStartIndex + (int)xAxis.context.pointerValue;
if (chart.isTriggerOnClick)
{
if (serie.insertDataToHead)
index = index + (serie.context.totalDataIndex - serie.context.clickTotalDataIndex);
else if (serie.context.totalDataIndex >= serie.dataCount)
index = index - (serie.context.totalDataIndex - serie.context.clickTotalDataIndex);
if (index < 0 || index >= serie.dataCount)
{
index = -1;
flag = false;
}
}
if (component.context.xAxisClickIndex != index)
{
component.context.xAxisClickIndex = index;
if (component.onClickIndex != null)
{
component.onClickIndex(index);
}
}
serie.context.pointerEnter = true;
serie.context.pointerAxisDataIndexs.Add(index);
serie.context.pointerItemDataIndex = index;
xAxis.context.axisTooltipValue = xAxis.context.pointerValue;
xAxis.context.axisTooltipValue = index;
}
}
else
{
serie.context.pointerEnter = true;
if (isTriggerAxis)
{
serie.context.pointerEnter = true;
GetSerieDataIndexByAxis(serie, xAxis, grid);
}
else
{
GetSerieDataIndexByItem(serie, xAxis, grid);
}
}
return flag;
}
private void GetSerieDataByXYAxis(Serie serie, Axis xAxis, Axis yAxis)
@ -446,7 +518,7 @@ namespace XCharts.Runtime
{
axis.context.axisTooltipValue = serie.GetSerieData(serie.context.pointerItemDataIndex).GetData(dimension);
}
else if (component.type == Tooltip.Type.Corss)
else if (component.type == Tooltip.Type.Cross)
{
axis.context.axisTooltipValue = axis.context.pointerValue;
}
@ -464,7 +536,7 @@ namespace XCharts.Runtime
if (tooltip.context.trigger == Tooltip.Trigger.None) return false;
tooltip.context.data.param.Clear();
tooltip.context.data.title = serie.serieName;
tooltip.context.pointer = chart.pointerPos;
tooltip.context.pointer = GetTooltipPointerPos();
serie.handler.UpdateTooltipSerieParams(serie.context.pointerItemDataIndex, false, null,
tooltip.marker, tooltip.itemFormatter, tooltip.numericFormatter, tooltip.ignoreDataDefaultContent,
@ -472,12 +544,20 @@ namespace XCharts.Runtime
ref tooltip.context.data.title);
TooltipHelper.ResetTooltipParamsByItemFormatter(tooltip, chart);
tooltip.SetActive(true);
tooltip.SetActive(m_ShowTooltip);
tooltip.view.Refresh();
TooltipHelper.LimitInRect(tooltip, chart.chartRect);
return true;
}
private Vector2 GetTooltipPointerPos()
{
if (chart.isTriggerOnClick && chart.isPointerClick)
return chart.clickPos;
else
return chart.pointerPos;
}
private bool SetSerieTooltip(Tooltip tooltip, List<Serie> series)
{
if (tooltip.context.trigger == Tooltip.Trigger.None)
@ -489,10 +569,10 @@ namespace XCharts.Runtime
string category = null;
var showCategory = false;
var isTriggerByAxis = false;
var isTriggerByItem = false;
var isTriggerByItem = tooltip.context.trigger == Tooltip.Trigger.Item;
var dataIndex = -1;
tooltip.context.data.param.Clear();
tooltip.context.pointer = chart.pointerPos;
tooltip.context.pointer = GetTooltipPointerPos();
if (m_PointerContainer is GridCoord)
{
GetAxisCategory(m_PointerContainer.index, ref dataIndex, ref category);
@ -514,11 +594,13 @@ namespace XCharts.Runtime
}
}
var triggerSerieCount = 0;
for (int i = 0; i < series.Count; i++)
{
var serie = series[i];
if (!serie.show) continue;
if (isTriggerByItem && serie.context.pointerItemDataIndex < 0) continue;
triggerSerieCount++;
serie.context.isTriggerByAxis = isTriggerByAxis;
if (isTriggerByAxis && dataIndex >= 0 && serie.context.pointerItemDataIndex < 0)
serie.context.pointerItemDataIndex = dataIndex;
@ -528,10 +610,14 @@ namespace XCharts.Runtime
ref tooltip.context.data.param,
ref tooltip.context.data.title);
}
if (triggerSerieCount <= 0)
{
return false;
}
TooltipHelper.ResetTooltipParamsByItemFormatter(tooltip, chart);
if (tooltip.context.data.param.Count > 0 || !string.IsNullOrEmpty(tooltip.context.data.title))
{
tooltip.SetActive(true);
tooltip.SetActive(m_ShowTooltip);
if (tooltip.view != null)
tooltip.view.Refresh();
TooltipHelper.LimitInRect(tooltip, chart.chartRect);
@ -551,7 +637,7 @@ namespace XCharts.Runtime
{
dataIndex = double.IsNaN(axis.context.pointerValue)
? axis.context.dataZoomStartIndex
: axis.context.dataZoomStartIndex + (int)axis.context.pointerValue;
: axis.context.dataZoomStartIndex + (int)axis.context.axisTooltipValue;
category = axis.GetData(dataIndex);
return true;
}
@ -612,7 +698,7 @@ namespace XCharts.Runtime
float splitWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, dataCount, dataZoom);
switch (tooltip.context.type)
{
case Tooltip.Type.Corss:
case Tooltip.Type.Cross:
case Tooltip.Type.Line:
float pX = grid.context.x;
pX += xAxis.IsCategory() ?
@ -624,7 +710,7 @@ namespace XCharts.Runtime
Vector2 ep = new Vector2(pX, grid.context.y + grid.context.height);
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
if (tooltip.context.type == Tooltip.Type.Corss)
if (tooltip.context.type == Tooltip.Type.Cross)
{
sp = new Vector2(grid.context.x, chart.pointerPos.y);
ep = new Vector2(grid.context.x + grid.context.width, chart.pointerPos.y);
@ -678,7 +764,7 @@ namespace XCharts.Runtime
float splitWidth = AxisHelper.GetDataWidth(yAxis, grid.context.height, dataCount, dataZoom);
switch (tooltip.context.type)
{
case Tooltip.Type.Corss:
case Tooltip.Type.Cross:
case Tooltip.Type.Line:
float pY = (float)(grid.context.y + yAxis.context.pointerValue * splitWidth +
(yAxis.boundaryGap ? splitWidth / 2 : 0));
@ -688,7 +774,7 @@ namespace XCharts.Runtime
Vector2 ep = new Vector2(grid.context.x + grid.context.width, pY);
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
if (tooltip.context.type == Tooltip.Type.Corss)
if (tooltip.context.type == Tooltip.Type.Cross)
{
sp = new Vector2(chart.pointerPos.x, grid.context.y);
ep = new Vector2(chart.pointerPos.x, grid.context.y + grid.context.height);
@ -733,7 +819,7 @@ namespace XCharts.Runtime
switch (tooltip.context.type)
{
case Tooltip.Type.Corss:
case Tooltip.Type.Cross:
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
var dist = Vector2.Distance(chart.pointerPos, cenPos);
if (dist > radius) dist = radius;

View File

@ -386,8 +386,8 @@ namespace XCharts.Runtime
}
}
public float runtimeRangeMinHeight { get { return (float) ((rangeMin - min) / (max - min) * itemHeight); } }
public float runtimeRangeMaxHeight { get { return (float) ((rangeMax - min) / (max - min) * itemHeight); } }
public float runtimeRangeMinHeight { get { return (float)((rangeMin - min) / (max - min) * itemHeight); } }
public float runtimeRangeMaxHeight { get { return (float)((rangeMax - min) / (max - min) * itemHeight); } }
public void AddColors(List<Color32> colors)
{
@ -413,6 +413,25 @@ namespace XCharts.Runtime
}
}
public Color32 GetColor(double xValue, double yValue, double zValue, byte alpha = 255)
{
Color32 color;
if (m_Dimension == 0)
{
color = GetColor(xValue);
}
else if (m_Dimension == 1)
{
color = GetColor(yValue);
}
else
{
color = GetColor(zValue);
}
color.a = alpha;
return color;
}
public Color32 GetColor(double value)
{
int index = GetIndex(value);
@ -437,7 +456,7 @@ namespace XCharts.Runtime
if (index == splitNumber - 1)
return m_InRange[index].color;
else
return Color32.Lerp(m_InRange[index].color, m_InRange[index + 1].color, (float) rate);
return Color32.Lerp(m_InRange[index].color, m_InRange[index + 1].color, (float)rate);
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14f9081aa22ba4bcb9cdbfbb95c7221e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,270 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using XUGL;
namespace XCharts.Runtime
{
/// <summary>
/// View control component in 3D coordinate system.
/// ||3D视角控制组件。
/// </summary>
[Since("v3.11.0")]
[Serializable]
public class ViewControl : ChildComponent
{
[SerializeField][Range(-90, 180)] private float m_Alpha = 90f;
[SerializeField][Range(-90, 90)] private float m_Beta = 55f;
/// <summary>
/// The angle of the view in the x-z plane.
/// ||视角在x-z平面的角度。
/// </summary>
public float alpha
{
get { return m_Alpha; }
set { if (PropertyUtil.SetStruct(ref m_Alpha, value)) SetVerticesDirty(); }
}
/// <summary>
/// The angle of the view in the y-z plane.
/// ||视角在y-z平面的角度。
/// </summary>
public float beta
{
get { return m_Beta; }
set { if (PropertyUtil.SetStruct(ref m_Beta, value)) SetVerticesDirty(); }
}
}
/// <summary>
/// Grid component.
/// ||Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
/// ||3D网格组件。
/// 3D直角坐标系内绘图网格。可以在网格上绘制3D折线图3D柱状图3D散点图。
/// </summary>
[Serializable]
[ComponentHandler(typeof(GridCoord3DHandler), true)]
public class GridCoord3D : CoordSystem, IUpdateRuntimeData, ISerieContainer
{
[SerializeField] private bool m_Show = true;
[SerializeField] private float m_Left = 0.15f;
[SerializeField] private float m_Right = 0.2f;
[SerializeField] private float m_Top = 0.3f;
[SerializeField] private float m_Bottom = 0.15f;
[SerializeField] private bool m_ShowBorder = false;
[SerializeField] private float m_BoxWidth = 0.55f;
[SerializeField] private float m_BoxHeight = 0.4f;
[SerializeField] private float m_BoxDepth = 0.2f;
[SerializeField] private bool m_XYExchanged = false;
[SerializeField] private ViewControl m_ViewControl = new ViewControl();
public GridCoord3DContext context = new GridCoord3DContext();
/// <summary>
/// Whether to show the grid in rectangular coordinate.
/// ||是否显示直角坐标系网格。
/// </summary>
public bool show
{
get { return m_Show; }
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
}
/// <summary>
/// Distance between grid component and the left side of the container.
/// ||grid 组件离容器左侧的距离。
/// </summary>
public float left
{
get { return m_Left; }
set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetAllDirty(); }
}
/// <summary>
/// Distance between grid component and the right side of the container.
/// ||grid 组件离容器右侧的距离。
/// </summary>
public float right
{
get { return m_Right; }
set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetAllDirty(); }
}
/// <summary>
/// Distance between grid component and the top side of the container.
/// ||grid 组件离容器上侧的距离。
/// </summary>
public float top
{
get { return m_Top; }
set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetAllDirty(); }
}
/// <summary>
/// Distance between grid component and the bottom side of the container.
/// ||grid 组件离容器下侧的距离。
/// </summary>
public float bottom
{
get { return m_Bottom; }
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetAllDirty(); }
}
/// <summary>
/// Whether to show the grid border.
/// ||是否显示网格边框。
/// </summary>
public bool showBorder
{
get { return m_ShowBorder; }
set { if (PropertyUtil.SetStruct(ref m_ShowBorder, value)) SetVerticesDirty(); }
}
/// <summary>
/// The width of the box in the coordinate system.
/// ||坐标系的宽度。
/// </summary>
public float boxWidth
{
get { return m_BoxWidth; }
set { if (PropertyUtil.SetStruct(ref m_BoxWidth, value)) SetVerticesDirty(); }
}
/// <summary>
/// The height of the box in the coordinate system.
/// ||坐标系的高度。
/// </summary>
public float boxHeight
{
get { return m_BoxHeight; }
set { if (PropertyUtil.SetStruct(ref m_BoxHeight, value)) SetVerticesDirty(); }
}
/// <summary>
/// The depth of the box in the coordinate system.
/// ||坐标系的深度。
/// </summary>
public float boxDepth
{
get { return m_BoxDepth; }
set { if (PropertyUtil.SetStruct(ref m_BoxDepth, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether to exchange the x and y axes.
/// ||是否交换x和y轴。
/// </summary>
public bool xyExchanged
{
get { return m_XYExchanged; }
set { if (PropertyUtil.SetStruct(ref m_XYExchanged, value)) SetVerticesDirty(); }
}
/// <summary>
/// View control component in 3D coordinate system.
/// ||3D视角控制组件。
/// </summary>
public ViewControl viewControl
{
get { return m_ViewControl; }
//set { if (PropertyUtil.SetClass(ref m_ViewControl, value)) SetVerticesDirty(); }
}
public void UpdateRuntimeData(BaseChart chart)
{
var chartX = chart.chartX;
var chartY = chart.chartY;
var chartWidth = chart.chartWidth;
var chartHeight = chart.chartHeight;
var actualLeft = left <= 1 ? left * chartWidth : left;
var actualBottom = bottom <= 1 ? bottom * chartHeight : bottom;
var actualBoxWidth = m_BoxWidth <= 1 ? m_BoxWidth * chartWidth : m_BoxWidth;
var actualBoxHeight = m_BoxHeight <= 1 ? m_BoxHeight * chartHeight : m_BoxHeight;
var actualBoxDepth = m_BoxDepth <= 1 ? m_BoxDepth * chartWidth : m_BoxDepth;
context.x = chartX + actualLeft;
context.y = chartY + actualBottom;
context.pointA.x = context.x;
context.pointA.y = context.y;
var angle = m_ViewControl.alpha * Mathf.Deg2Rad;
context.pointD.x = context.x + actualBoxWidth * Mathf.Sin(angle);
context.pointD.y = context.y - actualBoxWidth * Mathf.Cos(angle);
angle = (90 - m_ViewControl.beta) * Mathf.Deg2Rad;
context.pointB.x = context.x + actualBoxDepth * Mathf.Cos(angle);
context.pointB.y = context.y + actualBoxDepth * Mathf.Sin(angle);
context.pointC = context.pointB + (context.pointD - context.pointA);
context.pointE.x = context.pointA.x;
context.pointE.y = context.pointA.y + actualBoxHeight;
var diff = context.pointE - context.pointA;
context.pointF = context.pointB + diff;
context.pointG = context.pointC + diff;
context.pointH = context.pointD + diff;
var minX = Mathf.Min(context.pointA.x, context.pointB.x, context.pointC.x, context.pointD.x, context.pointE.x, context.pointF.x, context.pointG.x, context.pointH.x);
var minY = Mathf.Min(context.pointA.y, context.pointB.y, context.pointC.y, context.pointD.y, context.pointE.y, context.pointF.y, context.pointG.y, context.pointH.y);
var maxX = Mathf.Max(context.pointA.x, context.pointB.x, context.pointC.x, context.pointD.x, context.pointE.x, context.pointF.x, context.pointG.x, context.pointH.x);
var maxY = Mathf.Max(context.pointA.y, context.pointB.y, context.pointC.y, context.pointD.y, context.pointE.y, context.pointF.y, context.pointG.y, context.pointH.y);
context.maxRect.x = minX;
context.maxRect.y = minY;
context.maxRect.width = maxX - minX;
context.maxRect.height = maxY - minY;
}
/// <summary>
/// The opening of the coordinate system faces to the left.
/// 坐标系开口朝向左边。
/// </summary>
/// <returns></returns>
public bool IsLeft()
{
return context.pointB.x < context.pointA.x;
}
/// <summary>
/// Whether the pointer is in the grid.
/// ||指针是否在网格内。
/// </summary>
/// <returns></returns>
public bool IsPointerEnter()
{
return context.isPointerEnter;
}
/// <summary>
/// Whether the given position is in the grid.
/// ||给定的位置是否在网格内。
/// </summary>
/// <param name="pos"></param>
/// <returns></returns>
public bool Contains(Vector3 pos)
{
if (!context.maxRect.Contains(pos)) return false;
if (UGLHelper.IsPointInPolygon(pos, context.pointA, context.pointB, context.pointC, context.pointD)) return true;
if (UGLHelper.IsPointInPolygon(pos, context.pointB, context.pointF, context.pointG, context.pointC)) return true;
if (IsLeft())
if (UGLHelper.IsPointInPolygon(pos, context.pointC, context.pointG, context.pointH, context.pointD)) return true;
else
if (UGLHelper.IsPointInPolygon(pos, context.pointA, context.pointE, context.pointF, context.pointB)) return true;
return false;
}
/// <summary>
/// Clamp the position of pos to the grid.
/// ||将位置限制在网格内。
/// </summary>
/// <param name="pos"></param>
public void Clamp(ref Vector3 pos)
{
//TODO:
}
/// <summary>
/// Determines whether a given line segment will not intersect the Grid boundary at all.
/// ||判断给定的线段是否与Grid边界是否完全不会相交。
/// </summary>
/// <param name="sp"></param>
/// <param name="ep"></param>
/// <returns></returns>
public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
{
//TODO:
return false;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95f8c8c3492e54987af59175d94f8761
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Runtime
{
public class GridCoord3DContext : MainComponentContext
{
public float x;
public float y;
public Rect maxRect = new Rect(0, 0, 0, 0);
public bool isPointerEnter;
public List<ChartLabel> endLabelList = new List<ChartLabel>();
//public Vector3 position = Vector3.zero;
public Vector3 pointA = Vector3.zero;
public Vector3 pointB = Vector3.zero;
public Vector3 pointC = Vector3.zero;
public Vector3 pointD = Vector3.zero;
public Vector3 pointE = Vector3.zero;
public Vector3 pointF = Vector3.zero;
public Vector3 pointG = Vector3.zero;
public Vector3 pointH = Vector3.zero;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a4a0f1dda078b4877bfabe3c16815498
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,79 @@
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using XUGL;
namespace XCharts.Runtime
{
[UnityEngine.Scripting.Preserve]
internal sealed class GridCoord3DHandler : MainComponentHandler<GridCoord3D>
{
public override void InitComponent()
{
var grid = component;
grid.painter = chart.painter;
grid.refreshComponent = delegate ()
{
grid.UpdateRuntimeData(chart);
chart.OnCoordinateChanged();
};
grid.refreshComponent();
}
public override void CheckComponent(StringBuilder sb)
{
var grid = component;
if (grid.left >= chart.chartWidth)
sb.Append("warning:grid->left > chartWidth\n");
if (grid.right >= chart.chartWidth)
sb.Append("warning:grid->right > chartWidth\n");
if (grid.top >= chart.chartHeight)
sb.Append("warning:grid->top > chartHeight\n");
if (grid.bottom >= chart.chartHeight)
sb.Append("warning:grid->bottom > chartHeight\n");
if (grid.left + grid.right >= chart.chartWidth)
sb.Append("warning:grid.left + grid.right > chartWidth\n");
if (grid.top + grid.bottom >= chart.chartHeight)
sb.Append("warning:grid.top + grid.bottom > chartHeight\n");
}
public override void Update()
{
if (chart.isPointerInChart)
{
component.context.isPointerEnter = component.Contains(chart.pointerPos);
}
else
{
component.context.isPointerEnter = false;
}
}
public override void DrawUpper(VertexHelper vh)
{
DrawCoord(vh, component);
}
private void DrawCoord(VertexHelper vh, GridCoord3D grid)
{
if (!grid.show) return;
if (grid.showBorder)
{
var borderWidth = chart.theme.axis.lineWidth;
var borderColor = chart.theme.axis.lineColor;
if (grid.IsLeft())
{
UGL.DrawLine(vh, grid.context.pointA, grid.context.pointE, borderWidth, borderColor);
UGL.DrawLine(vh, grid.context.pointE, grid.context.pointF, borderWidth, borderColor);
UGL.DrawLine(vh, grid.context.pointE, grid.context.pointH, borderWidth, borderColor);
}
else
{
UGL.DrawLine(vh, grid.context.pointD, grid.context.pointH, borderWidth, borderColor);
UGL.DrawLine(vh, grid.context.pointE, grid.context.pointH, borderWidth, borderColor);
UGL.DrawLine(vh, grid.context.pointG, grid.context.pointH, borderWidth, borderColor);
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 92481e92b90724f46b3a7e8c585e12e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -532,6 +532,7 @@ namespace XCharts.Runtime
xAxis.context.maxValue = 0;
yAxis.context.minValue = 0;
yAxis.context.maxValue = 0;
ResetChartStatus();
RefreshChart();
}
}
@ -566,6 +567,26 @@ namespace XCharts.Runtime
}
}
/// <summary>
/// set insert data to head.
/// ||设置数据插入到头部。
/// </summary>
/// <param name="insertDataToHead"></param>
[Since("v3.11.0")]
public void SetInsertDataToHead(bool insertDataToHead)
{
foreach (var serie in m_Series)
serie.insertDataToHead = insertDataToHead;
var coms = GetChartComponents<XAxis>();
foreach (var com in coms)
{
var axis = com as XAxis;
if (axis.type == Axis.AxisType.Category)
axis.insertDataToHead = insertDataToHead;
}
}
public Vector3 GetTitlePosition(Title title)
{
return chartPosition + title.location.GetPosition(chartWidth, chartHeight);
@ -735,7 +756,8 @@ namespace XCharts.Runtime
[Since("v3.7.0")]
public void CancelTooltip()
{
m_PointerEventData = null;
pointerMoveEventData = null;
pointerClickEventData = null;
var tooltip = GetChartComponent<Tooltip>();
if (tooltip != null)
{
@ -750,6 +772,7 @@ namespace XCharts.Runtime
[Since("v3.10.0")]
public void ResetChartStatus()
{
foreach (var component in m_Components) component.ResetStatus();
foreach (var handler in m_SerieHandlers) handler.ForceUpdateSerieContext();
}
}

View File

@ -317,13 +317,29 @@ namespace XCharts.Runtime
GridCoord grid = null;
if (dataZoom.xAxisIndexs != null && dataZoom.xAxisIndexs.Count > 0)
{
var xAxis = GetChartComponent<XAxis>(dataZoom.xAxisIndexs[0]);
grid = GetChartComponent<GridCoord>(xAxis.gridIndex);
for (int i = 0; i < dataZoom.xAxisIndexs.Count; i++)
{
var xAxis = GetChartComponent<XAxis>(dataZoom.xAxisIndexs[i]);
var tempGrid = GetChartComponent<GridCoord>(xAxis.gridIndex);
if (tempGrid.IsPointerEnter())
{
grid = tempGrid;
break;
}
}
}
else if (dataZoom.yAxisIndexs != null && dataZoom.yAxisIndexs.Count > 0)
{
var yAxis = GetChartComponent<YAxis>(dataZoom.yAxisIndexs[0]);
grid = GetChartComponent<GridCoord>(yAxis.gridIndex);
for (int i = 0; i < dataZoom.yAxisIndexs.Count; i++)
{
var yAxis = GetChartComponent<YAxis>(dataZoom.yAxisIndexs[i]);
var tempGrid = GetChartComponent<GridCoord>(yAxis.gridIndex);
if (tempGrid.IsPointerEnter())
{
grid = tempGrid;
break;
}
}
}
if (grid == null) return GetChartComponent<GridCoord>();
else return grid;

View File

@ -11,7 +11,19 @@ namespace XCharts.Runtime
public virtual void GetSeriesMinMaxValue(Axis axis, int axisIndex, out double tempMinValue, out double tempMaxValue)
{
var needAnimationData = !axis.context.needAnimation;
if (IsAllAxisValue())
if (axis is XAxis3D)
{
SeriesHelper.GetXMinMaxValue(this, axisIndex, axis.inverse, out tempMinValue, out tempMaxValue, false, false, needAnimationData);
}
else if (axis is ZAxis3D)
{
SeriesHelper.GetZMinMaxValue(this, axisIndex, axis.inverse, out tempMinValue, out tempMaxValue, false, false, needAnimationData);
}
else if (axis is YAxis3D)
{
SeriesHelper.GetYMinMaxValue(this, axisIndex, axis.inverse, out tempMinValue, out tempMaxValue, false, false, needAnimationData);
}
else if (IsAllAxisValue())
{
if (axis is XAxis)
{

View File

@ -447,16 +447,16 @@ namespace XCharts.Runtime
/// ||添加一个关系图的关系数据。
/// </summary>
/// <param name="serieIndex">the index of serie</param>
/// <param name="sourceName">the source name of link</param>
/// <param name="targetName">the target name of link</param>
/// <param name="sourceId">the source id of link</param>
/// <param name="targetId">the target id of link</param>
/// <param name="value">the value of link</param>
/// <returns></returns>
public SerieDataLink AddLink(int serieIndex, string sourceName, string targetName, double value)
public SerieDataLink AddLink(int serieIndex, string sourceId, string targetId, double value = 0)
{
var serie = GetSerie(serieIndex);
if (serie != null)
{
var link = serie.AddLink(sourceName, targetName, value);
var link = serie.AddLink(sourceId, targetId, value);
RefreshPainter(serie.painter);
return link;
}

View File

@ -124,9 +124,15 @@ namespace XCharts.Runtime
base.InitComponent();
SeriesHelper.UpdateSerieNameList(this, ref m_LegendRealShowName);
foreach (var handler in m_ComponentHandlers)
{
handler.InitComponent();
handler.inited = true;
}
foreach (var handler in m_SerieHandlers)
{
handler.InitComponent();
handler.inited = true;
}
m_DebugInfo.Init(this);
}
@ -216,7 +222,15 @@ namespace XCharts.Runtime
foreach (var handler in m_SerieHandlers) handler.BeforeUpdate();
foreach (var handler in m_ComponentHandlers) handler.BeforceSerieUpdate();
foreach (var handler in m_SerieHandlers) handler.Update();
foreach (var handler in m_ComponentHandlers) handler.Update();
foreach (var handler in m_ComponentHandlers)
{
if (!handler.inited)
{
handler.InitComponent();
handler.inited = true;
}
handler.Update();
}
foreach (var handler in m_SerieHandlers) handler.AfterUpdate();
m_DebugInfo.Update();

View File

@ -43,16 +43,21 @@ namespace XCharts.Runtime
public Vector2 graphMaxAnchor { get { return m_GraphMaxAnchor; } }
public Vector2 graphAnchoredPosition { get { return m_GraphAnchoredPosition; } }
/// <summary>
/// The postion of pointer.
/// The postion of pointer move.
/// ||鼠标位置。
/// </summary>
public Vector2 pointerPos { get; protected set; }
public Vector2 clickPos { get; protected set; }
/// <summary>
/// Whether the mouse pointer is in the chart.
/// ||鼠标是否在图表内。
/// </summary>
public bool isPointerInChart
{ get { return m_PointerEventData != null; } }
public bool isPointerInChart { get { return pointerMoveEventData != null; } }
/// <summary>
/// Whether the mouse click the chart.
/// ||鼠标是否点击了图表。
/// </summary>
public bool isPointerClick { get { return pointerClickEventData != null; } }
/// <summary>
/// 警告信息。
/// </summary>

View File

@ -35,7 +35,9 @@ namespace XCharts.Runtime
protected bool m_PainerDirty = false;
protected bool m_IsOnValidate = false;
protected Vector3 m_LastLocalPosition;
protected PointerEventData m_PointerEventData;
internal PointerEventData pointerMoveEventData;
internal PointerEventData pointerClickEventData;
internal bool isTriggerOnClick = false;
protected Action<PointerEventData, BaseGraph> m_OnPointerClick;
protected Action<PointerEventData, BaseGraph> m_OnPointerDown;
@ -213,17 +215,23 @@ namespace XCharts.Runtime
private void CheckPointerPos()
{
if (!isPointerInChart) return;
if (canvas == null) return;
Vector2 mousePos = m_PointerEventData.position;
if (pointerMoveEventData != null)
{
pointerPos = MousePos2ChartPos(pointerMoveEventData.position);
}
}
private Vector2 MousePos2ChartPos(Vector2 mousePos)
{
Vector2 local;
if (!ScreenPointToChartPoint(mousePos, out local))
{
pointerPos = Vector2.zero;
return Vector2.zero;
}
else
{
pointerPos = local;
return local;
}
}
@ -269,6 +277,8 @@ namespace XCharts.Runtime
public virtual void OnPointerClick(PointerEventData eventData)
{
pointerClickEventData = eventData;
clickPos = MousePos2ChartPos(pointerClickEventData.position);
if (m_OnPointerClick != null) m_OnPointerClick(eventData, this);
}
@ -284,13 +294,14 @@ namespace XCharts.Runtime
public virtual void OnPointerEnter(PointerEventData eventData)
{
m_PointerEventData = eventData;
pointerMoveEventData = eventData;
if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this);
}
public virtual void OnPointerExit(PointerEventData eventData)
{
m_PointerEventData = null;
pointerMoveEventData = null;
pointerClickEventData = null;
if (m_OnPointerExit != null) m_OnPointerExit(eventData, this);
}

View File

@ -54,6 +54,8 @@ namespace XCharts.Runtime
public virtual void Reset() { }
public virtual void ResetStatus() { }
public virtual void ClearData() { }
public virtual void ClearDirty()
@ -91,6 +93,7 @@ namespace XCharts.Runtime
public int order { get; internal set; }
public BaseChart chart { get; internal set; }
public ComponentHandlerAttribute attribute { get; internal set; }
public bool inited { get; internal set; }
public virtual void InitComponent() { }
public virtual void RemoveComponent() { }
@ -120,7 +123,7 @@ namespace XCharts.Runtime
internal override void SetComponent(MainComponent component)
{
this.component = (T) component;
this.component = (T)component;
}
}
}

View File

@ -7,7 +7,7 @@ namespace XCharts.Runtime
/// the data struct of graph.
/// ||数据结构-图。
/// </summary>
public class Graph
public class GraphData
{
public bool directed;
public List<GraphNode> nodes = new List<GraphNode>();
@ -16,7 +16,7 @@ namespace XCharts.Runtime
public Dictionary<string, GraphNode> nodeMap = new Dictionary<string, GraphNode>();
public Dictionary<string, GraphEdge> edgeMap = new Dictionary<string, GraphEdge>();
public Graph(bool directed)
public GraphData(bool directed)
{
this.directed = directed;
}
@ -42,11 +42,27 @@ namespace XCharts.Runtime
double totalValue = 0;
foreach (var node in nodes)
{
totalValue += node.totalValues;
if (node.IsAnyInEdgesExpanded())
{
totalValue += node.totalValues;
}
}
return totalValue;
}
public static int GetExpandedNodesCount(List<GraphNode> nodes)
{
int count = 0;
foreach (var node in nodes)
{
if (node.IsAnyInEdgesExpanded())
{
count++;
}
}
return count;
}
public List<List<GraphNode>> GetDepthNodes()
{
List<List<GraphNode>> depthNodes = new List<List<GraphNode>>();
@ -108,7 +124,7 @@ namespace XCharts.Runtime
// {
// if (recursiveCount > 50)
// {
// XLog.Error("Graph.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
// XLog.Error("GraphData.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
// return;
// }
// if (node.inDegree == 0)
@ -129,7 +145,7 @@ namespace XCharts.Runtime
{
if (recursiveCount > 50)
{
XLog.Error("Graph.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
XLog.Error("GraphData.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
return 0;
}
int depth = 0;
@ -193,7 +209,7 @@ namespace XCharts.Runtime
}
}
public GraphNode AddNode(string nodeId, string nodeName, int dataIndex)
public GraphNode AddNode(string nodeId, string nodeName, int dataIndex, double value)
{
if (nodeMap.ContainsKey(nodeId))
{
@ -214,27 +230,27 @@ namespace XCharts.Runtime
GraphNode node1, node2;
if (!nodeMap.TryGetValue(nodeId1, out node1))
{
XLog.Warning("Graph.AddEdge(): " + nodeId1 + " not exist");
XLog.Warning("GraphData.AddEdge(): " + nodeId1 + " not exist");
return null;
}
if (!nodeMap.TryGetValue(nodeId2, out node2))
{
XLog.Warning("Graph.AddEdge(): " + nodeId2 + " not exist");
XLog.Warning("GraphData.AddEdge(): " + nodeId2 + " not exist");
return null;
}
if (node1 == null)
{
XLog.Warning("Graph.AddEdge(): node1 is null");
XLog.Warning("GraphData.AddEdge(): node1 is null");
return null;
}
if (node2 == null)
{
XLog.Warning("Graph.AddEdge(): node2 is null");
XLog.Warning("GraphData.AddEdge(): node2 is null");
return null;
}
if (node1 == node2)
if (directed && node1 == node2)
{
XLog.Warning("Graph.AddEdge(): node1 == node2");
XLog.Warning("GraphData.AddEdge(): node1 == node2:" + node1);
return null;
}
string edgeKey = nodeId1 + "_" + nodeId2;
@ -331,6 +347,35 @@ namespace XCharts.Runtime
}
}
}
public void ExpandNode(string nodeId, bool flag)
{
var node = GetNode(nodeId);
if (node != null)
{
node.Expand(flag);
}
}
public void ExpandAllNodes(bool flag, int level = -1)
{
foreach (var node in nodes)
{
if (level < 0 || node.level == level)
{
node.Expand(flag);
}
}
}
public bool IsAllNodeInZeroPosition()
{
foreach (var node in nodes)
{
if (node.position != Vector3.zero) return false;
}
return true;
}
}
/// <summary>
@ -341,13 +386,20 @@ namespace XCharts.Runtime
{
public string id;
public string name;
public double value;
public List<GraphEdge> edges = new List<GraphEdge>();
public List<GraphEdge> inEdges = new List<GraphEdge>();
public List<GraphEdge> outEdges = new List<GraphEdge>();
public Graph hostGraph;
public GraphData hostGraph;
public int dataIndex;
public bool visited;
public int depth = -1;
public bool expand = true;
public int level = 0;
public Vector3 position = Vector3.zero;
public Vector3 pp = Vector3.zero;
public float weight;
public float repulsion;
public GraphNode(string id, string name, int dataIndex)
{
@ -388,6 +440,36 @@ namespace XCharts.Runtime
{
return name;
}
public bool IsAllInEdgesCollapsed()
{
if (inEdges.Count == 0) return false;
foreach (var edge in inEdges)
{
if (!edge.expand) return false;
}
return true;
}
public bool IsAnyInEdgesExpanded()
{
if (inEdges.Count == 0) return true;
foreach (var edge in inEdges)
{
if (edge.expand) return true;
}
return false;
}
public void Expand(bool flag)
{
if (expand == flag) return;
expand = flag;
foreach (var edge in outEdges)
{
edge.expand = flag;
}
}
}
/// <summary>
@ -400,11 +482,14 @@ namespace XCharts.Runtime
public GraphNode node1;
public GraphNode node2;
public double value;
public Graph hostGraph;
public GraphData hostGraph;
public List<Vector3> points = new List<Vector3>();
public List<Vector3> upPoints = new List<Vector3>();
public List<Vector3> downPoints = new List<Vector3>();
public float width;
public float distance;
public bool highlight;
public bool expand = true;
public GraphEdge(GraphNode node1, GraphNode node2, double value)
{
@ -412,5 +497,24 @@ namespace XCharts.Runtime
this.node2 = node2;
this.value = value;
}
public bool IsPointInEdge(Vector2 point)
{
if (upPoints.Count == 0 || downPoints.Count == 0) return false;
var lastCount = upPoints.Count - 1;
if (point.x < upPoints[0].x || point.x > upPoints[lastCount].x) return false;
if (point.y > upPoints[0].y && point.y > upPoints[lastCount].y) return false;
if (point.y < downPoints[0].y && point.y < downPoints[lastCount].y) return false;
for (int i = 0; i < upPoints.Count - 1; i++)
{
var diff = point.x - upPoints[i].x;
if (diff <= 0)
{
return point.y < upPoints[i].y && point.y > downPoints[i].y;
}
}
return false;
}
}
}

Some files were not shown because too many files have changed in this diff Show More