mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 21:38:49 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9e7371213 | ||
|
|
9349900ea5 |
@@ -2,6 +2,8 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
[master](#master)
|
[master](#master)
|
||||||
|
[v2.2.3](#v2.2.3)
|
||||||
|
[v2.2.2](#v2.2.2)
|
||||||
[v2.2.1](#v2.2.1)
|
[v2.2.1](#v2.2.1)
|
||||||
[v2.2.0](#v2.2.0)
|
[v2.2.0](#v2.2.0)
|
||||||
[v2.1.1](#v2.1.1)
|
[v2.1.1](#v2.1.1)
|
||||||
@@ -36,6 +38,19 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
# # v2.2.3
|
||||||
|
|
||||||
|
* (2021.06.20) Release `v2.2.3` version
|
||||||
|
* (2021.06.20) Fixed the default display of `Icon` in `Axis`
|
||||||
|
|
||||||
|
## v2.2.2
|
||||||
|
|
||||||
|
* (2021.06.18) Release `v2.2.2` version
|
||||||
|
* (2021.06.18) Optimize `Axis` to automatically hide `Icon` when `Label` is empty
|
||||||
|
* (2021.06.17) Fixed an issue where `maxCache` was set to one more number of actual data
|
||||||
|
* (2021.06.17) Fixed an issue where `TextMeshPro` could not be opened and closed in time to refresh
|
||||||
|
* (2021.06.17) Fixed an issue where `XCharts` always pops up when importing `XCharts`
|
||||||
|
|
||||||
## v2.2.1
|
## v2.2.1
|
||||||
|
|
||||||
* (2021.06.13) Release `v2.2.1` version
|
* (2021.06.13) Release `v2.2.1` version
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
[master](#master)
|
[master](#master)
|
||||||
|
[v2.2.3](#v2.2.3)
|
||||||
|
[v2.2.2](#v2.2.2)
|
||||||
[v2.2.1](#v2.2.1)
|
[v2.2.1](#v2.2.1)
|
||||||
[v2.2.0](#v2.2.0)
|
[v2.2.0](#v2.2.0)
|
||||||
[v2.1.1](#v2.1.1)
|
[v2.1.1](#v2.1.1)
|
||||||
@@ -36,6 +38,19 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
## v2.2.3
|
||||||
|
|
||||||
|
* (2021.06.20) 发布`v2.2.3`版本
|
||||||
|
* (2021.06.20) 修复`Axis`的`Icon`默认显示出来的问题
|
||||||
|
|
||||||
|
## v2.2.2
|
||||||
|
|
||||||
|
* (2021.06.18) 发布`v2.2.2`版本
|
||||||
|
* (2021.06.18) 优化`Axis`的`Label`为空时自动隐藏`Icon`
|
||||||
|
* (2021.06.17) 修复`maxCache`设置时实际数据个数多一个的问题
|
||||||
|
* (2021.06.17) 修复`TextMeshPro`的开启和关闭不及时刷新的问题
|
||||||
|
* (2021.06.17) 修复`XCharts`导入时总是弹出`XCharts Importer`的问题
|
||||||
|
|
||||||
## v2.2.1
|
## v2.2.1
|
||||||
|
|
||||||
* (2021.06.13) 发布`v2.2.1`版本
|
* (2021.06.13) 发布`v2.2.1`版本
|
||||||
|
|||||||
@@ -5,13 +5,12 @@
|
|||||||
/* */
|
/* */
|
||||||
/************************************************/
|
/************************************************/
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Build;
|
using UnityEditor.Build;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
|
[System.Obsolete]
|
||||||
public class XChartsBuild : IPreprocessBuild, IPostprocessBuild
|
public class XChartsBuild : IPreprocessBuild, IPostprocessBuild
|
||||||
{
|
{
|
||||||
public int callbackOrder => 1;
|
public int callbackOrder => 1;
|
||||||
|
|||||||
@@ -165,13 +165,14 @@ namespace XCharts
|
|||||||
Debug.LogError("TextMeshPro is not in the project, please import TextMeshPro package first.");
|
Debug.LogError("TextMeshPro is not in the project, please import TextMeshPro package first.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XChartsMgr.ModifyTMPRefence();
|
|
||||||
XChartsMgr.EnableTextMeshPro();
|
XChartsMgr.EnableTextMeshPro();
|
||||||
|
XChartsMgr.ModifyTMPRefence();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MenuItem("XCharts/TextMeshPro Disable")]
|
[MenuItem("XCharts/TextMeshPro Disable")]
|
||||||
public static void DisableTextMeshPro()
|
public static void DisableTextMeshPro()
|
||||||
{
|
{
|
||||||
|
XChartsMgr.ModifyTMPRefence(true);
|
||||||
XChartsMgr.DisableTextMeshPro();
|
XChartsMgr.DisableTextMeshPro();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (maxCache > 0)
|
if (maxCache > 0)
|
||||||
{
|
{
|
||||||
while (m_Data.Count > maxCache)
|
while (m_Data.Count >= maxCache)
|
||||||
{
|
{
|
||||||
m_NeedUpdateFilterData = true;
|
m_NeedUpdateFilterData = true;
|
||||||
m_Data.RemoveAt(m_InsertDataToHead ? m_Data.Count - 1 : 0);
|
m_Data.RemoveAt(m_InsertDataToHead ? m_Data.Count - 1 : 0);
|
||||||
|
|||||||
@@ -1024,7 +1024,6 @@ namespace XCharts
|
|||||||
var p2 = new Vector3(dataZoom.runtimeX, dataZoom.runtimeY + dataZoom.runtimeHeight);
|
var p2 = new Vector3(dataZoom.runtimeX, dataZoom.runtimeY + dataZoom.runtimeHeight);
|
||||||
var p3 = new Vector3(dataZoom.runtimeX + dataZoom.runtimeWidth, dataZoom.runtimeY + dataZoom.runtimeHeight);
|
var p3 = new Vector3(dataZoom.runtimeX + dataZoom.runtimeWidth, dataZoom.runtimeY + dataZoom.runtimeHeight);
|
||||||
var p4 = new Vector3(dataZoom.runtimeX + dataZoom.runtimeWidth, dataZoom.runtimeY);
|
var p4 = new Vector3(dataZoom.runtimeX + dataZoom.runtimeWidth, dataZoom.runtimeY);
|
||||||
var xAxis = chart.GetXAxis(0);
|
|
||||||
var lineColor = dataZoom.lineStyle.GetColor(chart.theme.dataZoom.dataLineColor);
|
var lineColor = dataZoom.lineStyle.GetColor(chart.theme.dataZoom.dataLineColor);
|
||||||
var lineWidth = dataZoom.lineStyle.GetWidth(chart.theme.dataZoom.dataLineWidth);
|
var lineWidth = dataZoom.lineStyle.GetWidth(chart.theme.dataZoom.dataLineWidth);
|
||||||
var borderWidth = dataZoom.borderWidth == 0 ? chart.theme.dataZoom.borderWidth : dataZoom.borderWidth;
|
var borderWidth = dataZoom.borderWidth == 0 ? chart.theme.dataZoom.borderWidth : dataZoom.borderWidth;
|
||||||
|
|||||||
@@ -1497,7 +1497,7 @@ namespace XCharts
|
|||||||
private void CheckMaxCache()
|
private void CheckMaxCache()
|
||||||
{
|
{
|
||||||
if (m_MaxCache <= 0) return;
|
if (m_MaxCache <= 0) return;
|
||||||
while (m_Data.Count > m_MaxCache)
|
while (m_Data.Count >= m_MaxCache)
|
||||||
{
|
{
|
||||||
m_NeedUpdateFilterData = true;
|
m_NeedUpdateFilterData = true;
|
||||||
if (m_InsertDataToHead) RemoveData(m_Data.Count - 1);
|
if (m_InsertDataToHead) RemoveData(m_Data.Count - 1);
|
||||||
|
|||||||
@@ -928,7 +928,6 @@ namespace XCharts
|
|||||||
var halfWid = visualMap.itemWidth / 2;
|
var halfWid = visualMap.itemWidth / 2;
|
||||||
var halfHig = visualMap.itemHeight / 2;
|
var halfHig = visualMap.itemHeight / 2;
|
||||||
var splitNum = visualMap.runtimeInRange.Count;
|
var splitNum = visualMap.runtimeInRange.Count;
|
||||||
var splitWid = visualMap.itemHeight / (splitNum - 1);
|
|
||||||
var colors = visualMap.runtimeInRange;
|
var colors = visualMap.runtimeInRange;
|
||||||
switch (visualMap.orient)
|
switch (visualMap.orient)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ namespace XCharts
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie){
|
public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie)
|
||||||
|
{
|
||||||
if (dataZoom == null || serie == null) return;
|
if (dataZoom == null || serie == null) return;
|
||||||
float min = 0;
|
float min = 0;
|
||||||
float max = 0;
|
float max = 0;
|
||||||
@@ -33,5 +34,27 @@ namespace XCharts
|
|||||||
dataZoom.runtimeStartValue = min + (max - min) * dataZoom.start / 100;
|
dataZoom.runtimeStartValue = min + (max - min) * dataZoom.start / 100;
|
||||||
dataZoom.runtimeEndValue = min + (max - min) * dataZoom.end / 100;
|
dataZoom.runtimeEndValue = min + (max - min) * dataZoom.end / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UpdateDataZoomRuntimeStartEndValue(List<DataZoom> dataZooms, Series series, SerieType serieType)
|
||||||
|
{
|
||||||
|
foreach (var dataZoom in dataZooms)
|
||||||
|
{
|
||||||
|
if (!dataZoom.enable) continue;
|
||||||
|
float min = float.MaxValue;
|
||||||
|
float max = float.MinValue;
|
||||||
|
foreach (var serie in series.list)
|
||||||
|
{
|
||||||
|
if (!serie.show || serie.type != serieType) continue;
|
||||||
|
if (!dataZoom.IsXAxisIndexValue(serie.xAxisIndex)) continue;
|
||||||
|
var serieMinValue = 0f;
|
||||||
|
var serieMaxValue = 0f;
|
||||||
|
SerieHelper.GetMinMaxData(serie, out serieMinValue, out serieMaxValue, null, 2);
|
||||||
|
if (serieMinValue < min) min = serieMinValue;
|
||||||
|
if (serieMaxValue > max) max = serieMaxValue;
|
||||||
|
}
|
||||||
|
dataZoom.runtimeStartValue = min + (max - min) * dataZoom.start / 100;
|
||||||
|
dataZoom.runtimeEndValue = min + (max - min) * dataZoom.end / 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ namespace XCharts
|
|||||||
/// <param name="min"></param>
|
/// <param name="min"></param>
|
||||||
/// <param name="max"></param>
|
/// <param name="max"></param>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
public static void GetMinMaxData(Serie serie, out float min, out float max, DataZoom dataZoom = null)
|
public static void GetMinMaxData(Serie serie, out float min, out float max, DataZoom dataZoom = null, int dimension = 0)
|
||||||
{
|
{
|
||||||
max = float.MinValue;
|
max = float.MinValue;
|
||||||
min = float.MaxValue;
|
min = float.MaxValue;
|
||||||
@@ -58,7 +58,9 @@ namespace XCharts
|
|||||||
var serieData = dataList[i];
|
var serieData = dataList[i];
|
||||||
if (serieData.show)
|
if (serieData.show)
|
||||||
{
|
{
|
||||||
var count = serie.showDataDimension > serieData.data.Count
|
var count = 0;
|
||||||
|
if (dimension > 0) count = dimension;
|
||||||
|
else count = serie.showDataDimension > serieData.data.Count
|
||||||
? serieData.data.Count
|
? serieData.data.Count
|
||||||
: serie.showDataDimension;
|
: serie.showDataDimension;
|
||||||
for (int j = 0; j < count; j++)
|
for (int j = 0; j < count; j++)
|
||||||
|
|||||||
@@ -575,19 +575,20 @@ namespace XCharts
|
|||||||
if ((inside && yAxis.IsLeft()) || (!inside && yAxis.IsRight()))
|
if ((inside && yAxis.IsLeft()) || (!inside && yAxis.IsRight()))
|
||||||
{
|
{
|
||||||
txt = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, Vector2.zero,
|
txt = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, Vector2.zero,
|
||||||
Vector2.zero, new Vector2(0, 0.5f), new Vector2(textWidth, textHeight), yAxis, theme.axis);
|
Vector2.zero, new Vector2(0, 0.5f), new Vector2(textWidth, textHeight), yAxis, theme.axis,
|
||||||
|
labelName, true);
|
||||||
txt.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleLeft));
|
txt.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleLeft));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
txt = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, Vector2.zero,
|
txt = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, Vector2.zero,
|
||||||
Vector2.zero, new Vector2(1, 0.5f), new Vector2(textWidth, textHeight), yAxis, theme.axis);
|
Vector2.zero, new Vector2(1, 0.5f), new Vector2(textWidth, textHeight), yAxis, theme.axis,
|
||||||
|
labelName, true);
|
||||||
txt.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleRight));
|
txt.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleRight));
|
||||||
}
|
}
|
||||||
var labelWidth = AxisHelper.GetScaleWidth(yAxis, grid.runtimeHeight, i + 1, dataZoom);
|
var labelWidth = AxisHelper.GetScaleWidth(yAxis, grid.runtimeHeight, i + 1, dataZoom);
|
||||||
if (i == 0) yAxis.axisLabel.SetRelatedText(txt.label, labelWidth);
|
if (i == 0) yAxis.axisLabel.SetRelatedText(txt.label, labelWidth);
|
||||||
txt.SetPosition(GetLabelYPosition(totalWidth + gapWidth, i, yAxisIndex, yAxis));
|
txt.SetPosition(GetLabelYPosition(totalWidth + gapWidth, i, yAxisIndex, yAxis));
|
||||||
txt.SetText(labelName);
|
|
||||||
yAxis.runtimeAxisLabelList.Add(txt);
|
yAxis.runtimeAxisLabelList.Add(txt);
|
||||||
totalWidth += labelWidth;
|
totalWidth += labelWidth;
|
||||||
}
|
}
|
||||||
@@ -693,14 +694,15 @@ namespace XCharts
|
|||||||
var labelWidth = AxisHelper.GetScaleWidth(xAxis, grid.runtimeWidth, i + 1, dataZoom);
|
var labelWidth = AxisHelper.GetScaleWidth(xAxis, grid.runtimeWidth, i + 1, dataZoom);
|
||||||
var inside = xAxis.axisLabel.inside;
|
var inside = xAxis.axisLabel.inside;
|
||||||
var isPercentStack = SeriesHelper.IsPercentStack(m_Series, SerieType.Bar);
|
var isPercentStack = SeriesHelper.IsPercentStack(m_Series, SerieType.Bar);
|
||||||
|
var labelName = AxisHelper.GetLabelName(xAxis, grid.runtimeWidth, i, xAxis.runtimeMinValue,
|
||||||
|
xAxis.runtimeMaxValue, dataZoom, isPercentStack);
|
||||||
var label = ChartHelper.AddAxisLabelObject(i, ChartCached.GetXAxisName(xAxisIndex, i), axisObj.transform,
|
var label = ChartHelper.AddAxisLabelObject(i, ChartCached.GetXAxisName(xAxisIndex, i), axisObj.transform,
|
||||||
new Vector2(0, 1), new Vector2(0, 1), new Vector2(1, 0.5f), new Vector2(textWidth, textHeight), xAxis, theme.axis);
|
new Vector2(0, 1), new Vector2(0, 1), new Vector2(1, 0.5f), new Vector2(textWidth, textHeight),
|
||||||
|
xAxis, theme.axis,labelName, true);
|
||||||
|
|
||||||
if (i == 0) xAxis.axisLabel.SetRelatedText(label.label, labelWidth);
|
if (i == 0) xAxis.axisLabel.SetRelatedText(label.label, labelWidth);
|
||||||
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
label.label.SetAlignment(axisLabelTextStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||||
label.SetPosition(GetLabelXPosition(totalWidth + textWidth / 2 + gapWidth, i, xAxisIndex, xAxis));
|
label.SetPosition(GetLabelXPosition(totalWidth + textWidth / 2 + gapWidth, i, xAxisIndex, xAxis));
|
||||||
label.SetText(AxisHelper.GetLabelName(xAxis, grid.runtimeWidth, i, xAxis.runtimeMinValue, xAxis.runtimeMaxValue, dataZoom,
|
|
||||||
isPercentStack));
|
|
||||||
xAxis.runtimeAxisLabelList.Add(label);
|
xAxis.runtimeAxisLabelList.Add(label);
|
||||||
totalWidth += labelWidth;
|
totalWidth += labelWidth;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ChartLabel AddAxisLabelObject(int index, string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax,
|
public static ChartLabel AddAxisLabelObject(int index, string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax,
|
||||||
Vector2 pivot, Vector2 sizeDelta, Axis axis, ComponentTheme theme)
|
Vector2 pivot, Vector2 sizeDelta, Axis axis, ComponentTheme theme, string content, bool autoHideWhenContentEmpty = false)
|
||||||
{
|
{
|
||||||
var textStyle = axis.axisLabel.textStyle;
|
var textStyle = axis.axisLabel.textStyle;
|
||||||
var iconStyle = axis.iconStyle;
|
var iconStyle = axis.iconStyle;
|
||||||
@@ -413,11 +413,17 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
GameObject.DestroyImmediate(oldText);
|
GameObject.DestroyImmediate(oldText);
|
||||||
}
|
}
|
||||||
|
var labelShow = axis.axisLabel.show && (axis.axisLabel.interval == 0 || index % (axis.axisLabel.interval + 1) == 0);
|
||||||
|
if (autoHideWhenContentEmpty && string.IsNullOrEmpty(content))
|
||||||
|
{
|
||||||
|
labelShow &= false;
|
||||||
|
}
|
||||||
label.label = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme);
|
label.label = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme);
|
||||||
label.icon = ChartHelper.AddIcon("Icon", label.gameObject.transform, iconStyle.width, iconStyle.height);
|
label.icon = ChartHelper.AddIcon("Icon", label.gameObject.transform, iconStyle.width, iconStyle.height);
|
||||||
label.SetAutoSize(false);
|
label.SetAutoSize(false);
|
||||||
label.UpdateIcon(iconStyle, axis.GetIcon(index));
|
label.UpdateIcon(iconStyle, axis.GetIcon(index));
|
||||||
label.label.SetActive(axis.axisLabel.show && (axis.axisLabel.interval == 0 || index % (axis.axisLabel.interval + 1) == 0));
|
label.label.SetActive(labelShow);
|
||||||
|
label.SetText(content);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(themeAssetPath);
|
Directory.CreateDirectory(themeAssetPath);
|
||||||
}
|
}
|
||||||
var assetPath = string.Format("{0}/{1}", XChartsSettings.THEME_ASSET_FOLDER, themeAssetName);
|
|
||||||
var themeAssetFilePath = string.Format("{0}/{1}.json", themeAssetPath, themeAssetName);
|
var themeAssetFilePath = string.Format("{0}/{1}.json", themeAssetPath, themeAssetName);
|
||||||
var json = JsonUtility.ToJson(theme, true);
|
var json = JsonUtility.ToJson(theme, true);
|
||||||
File.WriteAllText(themeAssetFilePath, json);
|
File.WriteAllText(themeAssetFilePath, json);
|
||||||
|
|||||||
@@ -143,14 +143,15 @@ namespace XCharts
|
|||||||
* (tickWidth + axis.axisLabel.margin);
|
* (tickWidth + axis.axisLabel.margin);
|
||||||
for (int i = 0; i < splitNumber; i++)
|
for (int i = 0; i < splitNumber; i++)
|
||||||
{
|
{
|
||||||
float labelWidth = AxisHelper.GetScaleWidth(axis, radius, i, null);
|
var labelWidth = AxisHelper.GetScaleWidth(axis, radius, i, null);
|
||||||
bool inside = axis.axisLabel.inside;
|
var inside = axis.axisLabel.inside;
|
||||||
var label = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
|
|
||||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(labelWidth, txtHig), axis, theme.axis);
|
|
||||||
if (i == 0) axis.axisLabel.SetRelatedText(label.label, labelWidth);
|
|
||||||
var isPercentStack = SeriesHelper.IsPercentStack(m_Series, SerieType.Bar);
|
var isPercentStack = SeriesHelper.IsPercentStack(m_Series, SerieType.Bar);
|
||||||
var labelName = AxisHelper.GetLabelName(axis, radius, i, axis.runtimeMinValue, axis.runtimeMaxValue,
|
var labelName = AxisHelper.GetLabelName(axis, radius, i, axis.runtimeMinValue, axis.runtimeMaxValue,
|
||||||
null, isPercentStack);
|
null, isPercentStack);
|
||||||
|
var label = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
|
||||||
|
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(labelWidth, txtHig), axis, theme.axis,
|
||||||
|
labelName);
|
||||||
|
if (i == 0) axis.axisLabel.SetRelatedText(label.label, labelWidth);
|
||||||
label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
label.label.SetAlignment(textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||||
label.SetText(labelName);
|
label.SetText(labelName);
|
||||||
var pos = ChartHelper.GetPos(cenPos, totalWidth, startAngle, true) + tickVetor;
|
var pos = ChartHelper.GetPos(cenPos, totalWidth, startAngle, true) + tickVetor;
|
||||||
@@ -226,13 +227,12 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
float scaleAngle = AxisHelper.GetScaleWidth(axis, total, i, null);
|
float scaleAngle = AxisHelper.GetScaleWidth(axis, total, i, null);
|
||||||
bool inside = axis.axisLabel.inside;
|
bool inside = axis.axisLabel.inside;
|
||||||
|
var labelName = AxisHelper.GetLabelName(axis, total, i, axis.runtimeMinValue, axis.runtimeMaxValue,
|
||||||
|
null, isPercentStack);
|
||||||
var label = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
|
var label = ChartHelper.AddAxisLabelObject(i, objName + i, axisObj.transform, new Vector2(0.5f, 0.5f),
|
||||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(scaleAngle, txtHig), axis, theme.axis);
|
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(scaleAngle, txtHig), axis,
|
||||||
|
theme.axis, labelName);
|
||||||
label.label.SetAlignment(axis.axisLabel.textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
label.label.SetAlignment(axis.axisLabel.textStyle.GetAlignment(TextAnchor.MiddleCenter));
|
||||||
label.SetText(AxisHelper.GetLabelName(axis, total, i, axis.runtimeMinValue, axis.runtimeMaxValue,
|
|
||||||
null, isPercentStack));
|
|
||||||
var pos = ChartHelper.GetPos(cenPos, radius + margin,
|
var pos = ChartHelper.GetPos(cenPos, radius + margin,
|
||||||
isCategory ? (totalAngle + scaleAngle / 2) : totalAngle, true);
|
isCategory ? (totalAngle + scaleAngle / 2) : totalAngle, true);
|
||||||
AxisHelper.AdjustCircleLabelPos(label, pos, cenPos, txtHig, Vector3.zero);
|
AxisHelper.AdjustCircleLabelPos(label, pos, cenPos, txtHig, Vector3.zero);
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ namespace XCharts
|
|||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
public class XChartsMgr : MonoBehaviour
|
public class XChartsMgr : MonoBehaviour
|
||||||
{
|
{
|
||||||
internal static string _version = "2.2.1";
|
internal static string _version = "2.2.3";
|
||||||
internal static int _versionDate = 20210613;
|
internal static int _versionDate = 20210620;
|
||||||
public static string version { get { return _version; } }
|
public static string version { get { return _version; } }
|
||||||
public static int versionDate { get { return _versionDate; } }
|
public static int versionDate { get { return _versionDate; } }
|
||||||
public static string fullVersion { get { return version + "-" + versionDate; } }
|
public static string fullVersion { get { return version + "-" + versionDate; } }
|
||||||
@@ -64,14 +64,6 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
[InitializeOnLoadMethod]
|
|
||||||
private static void OnInitializeOnLoadMethod()
|
|
||||||
{
|
|
||||||
XThemeMgr.ReloadThemeList();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
SerieLabelPool.ClearAll();
|
SerieLabelPool.ClearAll();
|
||||||
@@ -414,6 +406,7 @@ namespace XCharts
|
|||||||
var addedTMP = false;
|
var addedTMP = false;
|
||||||
var removedTMP = false;
|
var removedTMP = false;
|
||||||
var tmpName = "\"Unity.TextMeshPro\"";
|
var tmpName = "\"Unity.TextMeshPro\"";
|
||||||
|
var refCount = 0;
|
||||||
foreach (var line in lines)
|
foreach (var line in lines)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(line)) continue;
|
if (string.IsNullOrEmpty(line)) continue;
|
||||||
@@ -427,6 +420,12 @@ namespace XCharts
|
|||||||
if (line.Contains("],"))
|
if (line.Contains("],"))
|
||||||
{
|
{
|
||||||
referencesStart = false;
|
referencesStart = false;
|
||||||
|
if (refCount > 0)
|
||||||
|
{
|
||||||
|
var old = dest[dest.Count - 1];
|
||||||
|
if (old.EndsWith(","))
|
||||||
|
dest[dest.Count - 1] = old.Substring(0, old.Length - 1);
|
||||||
|
}
|
||||||
if (!removeTMP && !refs.Contains(tmpName))
|
if (!removeTMP && !refs.Contains(tmpName))
|
||||||
{
|
{
|
||||||
if (refs.Count > 0)
|
if (refs.Count > 0)
|
||||||
@@ -446,8 +445,12 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (!line.Contains(tmpName))
|
if (!line.Contains(tmpName))
|
||||||
{
|
{
|
||||||
removedTMP = true;
|
|
||||||
dest.Add(line);
|
dest.Add(line);
|
||||||
|
refCount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
removedTMP = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -462,7 +465,12 @@ namespace XCharts
|
|||||||
dest.Add(line);
|
dest.Add(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (addedTMP || removedTMP) File.WriteAllText(asmdefPath, string.Join("\n", dest.ToArray()));
|
if (addedTMP || removedTMP)
|
||||||
|
{
|
||||||
|
File.WriteAllText(asmdefPath, string.Join("\n", dest.ToArray()));
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "com.monitor1394.xcharts",
|
"name": "com.monitor1394.xcharts",
|
||||||
"displayName": "XCharts",
|
"displayName": "XCharts",
|
||||||
"version": "2.2.1",
|
"version": "2.2.3",
|
||||||
"date": "20210613",
|
"date": "20210620",
|
||||||
"checkdate": "20210613",
|
"checkdate": "20210620",
|
||||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"description": "A charting and data visualization library for Unity.",
|
"description": "A charting and data visualization library for Unity.",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": "2.2.1",
|
"version": "2.2.3",
|
||||||
"date": "20210613",
|
"date": "20210620",
|
||||||
"checkdate": "20210613",
|
"checkdate": "20210620",
|
||||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||||
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
|
"homepage": "https://github.com/monitor1394/unity-ugui-XCharts"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user