mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 08:50:10 +00:00
增加漏斗图基础代码支持
This commit is contained in:
@@ -247,13 +247,14 @@ namespace XCharts
|
||||
var gap = 0;
|
||||
var namegap = 0;
|
||||
#endif
|
||||
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height), m_DataDimension);
|
||||
EditorGUI.PropertyField(new Rect(drawRect.x, drawRect.y, pos.width - 2 * nameWid - 2, pos.height),
|
||||
m_DataDimension);
|
||||
var nameRect = new Rect(pos.width - 2 * nameWid + 14 + gap, drawRect.y, nameWid - gap, pos.height);
|
||||
if (XChartsSettings.editorBlockEnable)
|
||||
{
|
||||
nameRect.x += ChartEditorHelper.BLOCK_WIDTH;
|
||||
}
|
||||
if (GUI.Button(nameRect, new GUIContent("Name")))
|
||||
if (GUI.Button(nameRect, new GUIContent("name")))
|
||||
{
|
||||
m_ShowDataName.boolValue = !m_ShowDataName.boolValue;
|
||||
}
|
||||
@@ -262,10 +263,17 @@ namespace XCharts
|
||||
{
|
||||
iconRect.x += ChartEditorHelper.BLOCK_WIDTH;
|
||||
}
|
||||
if (GUI.Button(iconRect, new GUIContent("More...")))
|
||||
if (GUI.Button(iconRect, new GUIContent("more")))
|
||||
{
|
||||
m_ShowDataIcon.boolValue = !m_ShowDataIcon.boolValue;
|
||||
}
|
||||
var jsonRect = new Rect(pos.width - 70, drawRect.y - pos.height - 2, 90, pos.height);
|
||||
if (GUI.Button(jsonRect, new GUIContent("data from json")))
|
||||
{
|
||||
PraseJsonDataEditor.chart = prop.serializedObject.targetObject as BaseChart;
|
||||
PraseJsonDataEditor.serieIndex = index;
|
||||
PraseJsonDataEditor.ShowWindow();
|
||||
}
|
||||
AddSingleLineHeight();
|
||||
var listSize = m_Datas.arraySize;
|
||||
listSize = EditorGUI.IntField(drawRect, "Size", listSize);
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace XCharts
|
||||
PropertyField(prop, "m_LineType");
|
||||
PropertyField(prop, "m_LineColor");
|
||||
PropertyField(prop, "m_LineWidth");
|
||||
PropertyField(prop, "m_LineGap");
|
||||
PropertyField(prop, "m_LineLength1");
|
||||
PropertyField(prop, "m_LineLength2");
|
||||
PropertyField(prop, "m_TextStyle");
|
||||
|
||||
54
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs
Normal file
54
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
/************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class PraseJsonDataEditor : EditorWindow
|
||||
{
|
||||
public static BaseChart chart;
|
||||
public static int serieIndex;
|
||||
private static PraseJsonDataEditor window;
|
||||
private string inputJsonText = "";
|
||||
|
||||
public static void ShowWindow()
|
||||
{
|
||||
window = GetWindow<PraseJsonDataEditor>();
|
||||
window.titleContent = new GUIContent("PraseJsonData");
|
||||
window.minSize = new Vector2(450, 550);
|
||||
window.Focus();
|
||||
window.Show();
|
||||
}
|
||||
|
||||
void OnInspectorUpdate()
|
||||
{
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (chart == null)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
EditorGUILayout.LabelField("Input json data, or echarts serie data:");
|
||||
inputJsonText = EditorGUILayout.TextArea(inputJsonText, GUILayout.Height(400));
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
var serie = chart.series.GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
{
|
||||
serie.ParseJsonData(inputJsonText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/Window/PraseJsonDataEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dca7fd076eaf147c8839394e0652ecd0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user