mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 11:40:13 +00:00
Compare commits
18 Commits
v3.0.0-pre
...
v3.0.0-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4fac71987 | ||
|
|
20825c148f | ||
|
|
5476fa8d09 | ||
|
|
80c77fc69a | ||
|
|
621bc3dcfd | ||
|
|
1ed0ff377a | ||
|
|
426d437e6d | ||
|
|
6c0dcbbcbb | ||
|
|
4ade064266 | ||
|
|
1ad87920d0 | ||
|
|
b784900fda | ||
|
|
acba2f5c1e | ||
|
|
3bccbd0ab2 | ||
|
|
327661bfdd | ||
|
|
ed393ea560 | ||
|
|
3fbf5bc906 | ||
|
|
b7efcf87cf | ||
|
|
1aea9f3cfe |
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: ['https://www.paypal.com/paypalme/monitor1394','https://github.com/XCharts-Team/XCharts/blob/master/Documentation/res/alipay.png']
|
||||
40
CHANGELOG.md
40
CHANGELOG.md
@@ -2,6 +2,13 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.0.0-preivew7](#v3.0.0-preivew7)
|
||||
[v3.0.0-preivew6](#v3.0.0-preivew6)
|
||||
[v3.0.0-preivew5](#v3.0.0-preivew5)
|
||||
[v3.0.0-preivew4](#v3.0.0-preivew4)
|
||||
[v3.0.0-preivew3](#v3.0.0-preivew3)
|
||||
[v3.0.0-preivew2](#v3.0.0-preivew2)
|
||||
[v3.0.0-preivew1](#v3.0.0-preivew1)
|
||||
[v2.7.0](#v2.7.0)
|
||||
[v2.6.0](#v2.6.0)
|
||||
[v2.5.0](#v2.5.0)
|
||||
@@ -43,6 +50,37 @@
|
||||
|
||||
## master
|
||||
|
||||
## v3.0.0-preivew7
|
||||
|
||||
* (2022.04.07) 发布`v3.0.0-preivew7`版本
|
||||
* (2022.04.07) 修复`Pie`颜色不刷新的问题
|
||||
* (2022.03.31) 修复`Add Main Component`添加组件异常的问题
|
||||
* (2022.03.30) 修复`Axis`无法自定义`Label`颜色的问题
|
||||
|
||||
## v3.0.0-preivew6
|
||||
|
||||
* (2022.03.30) 发布`v3.0.0-preivew6`版本
|
||||
|
||||
## v3.0.0-preivew5
|
||||
|
||||
* (2022.03.26) 发布`v3.0.0-preivew5`版本
|
||||
|
||||
## v3.0.0-preivew4
|
||||
|
||||
* (2022.03.21) 发布`v3.0.0-preivew4`版本
|
||||
|
||||
## v3.0.0-preivew3
|
||||
|
||||
* (2022.03.09) 发布`v3.0.0-preivew3`版本
|
||||
|
||||
## v3.0.0-preivew2
|
||||
|
||||
* (2022.01.08) 发布`v3.0.0-preivew2`版本
|
||||
|
||||
## v3.0.0-preivew1
|
||||
|
||||
* (2022.01.07) 发布`v3.0.0-preivew1`版本
|
||||
|
||||
## v2.7.0
|
||||
|
||||
* (2022.03.20) 发布`v2.7.0`版本
|
||||
@@ -269,7 +307,7 @@
|
||||
## v1.6.0
|
||||
|
||||
* (2020.08.24) 发布`v1.6.0`版本
|
||||
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFQA-ZH.md)进行升级)
|
||||
* (2020.08.23) 重构代码,将与绘制相关的`Color`改为`Color32`,减少隐式转换(更新后会导致自定义的颜色丢失,可参考[问答29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md)进行升级)
|
||||
* (2020.08.15) 优化`PieChart`绘制表现效果#85
|
||||
* (2020.08.11) 增加`LiquidChart`数据变更动画#83
|
||||
* (2020.08.11) 优化`PieChart`文本堆叠和引线效果#85
|
||||
|
||||
@@ -215,7 +215,7 @@ Since the data type is upgraded to `double`, the implicit conversion of `float`
|
||||
## v1.6.0
|
||||
|
||||
* (2020.08.24) Release `v1.6.0` version
|
||||
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [Q&A 29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFQA-ZH.md) to upgrade)
|
||||
* (2020.08.23) Refactor code, replace `Color` with `Color32` for reduce implicit conversion (Can cause custom colors to lose, reference [FAQ 29](https://github.com/XCharts-Team/XCharts/blob/master/Assets/XCharts/Documentation/XChartsFAQ-ZH.md) to upgrade)
|
||||
* (2020.08.15) Optimized `PieChart` drawing performance effect #85
|
||||
* (2020.08.11) Added `LiquidChart` data change animation#83
|
||||
* (2020.08.11) Optimized `PieChart` text stack and lead line effects#85
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts Configuration](XChartsConfiguration-EN.md)</br>
|
||||
[XCharts Q&A](XChartsFQA-EN.md)
|
||||
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||
|
||||
## Class
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
- [HeatmapChart](#HeatmapChart)
|
||||
- [InteractData](#InteractData)
|
||||
- [ItemStyleHelper](#ItemStyleHelper)
|
||||
- [LangCandlestick](#LangCandlestick)
|
||||
- [LayerHelper](#LayerHelper)
|
||||
- [LegendContext](#LegendContext)
|
||||
- [LegendHelper](#LegendHelper)
|
||||
@@ -93,7 +92,7 @@
|
||||
- [VisualMapContext](#VisualMapContext)
|
||||
- [VisualMapHelper](#VisualMapHelper)
|
||||
- [XChartsMgr](#XChartsMgr)
|
||||
- [XChartsPackageResourceImporterWindow](#XChartsPackageResourceImporterWindow)
|
||||
- [XCResourceImporterWindow](#XCResourceImporterWindow)
|
||||
- [XCThemeMgr](#XCThemeMgr)
|
||||
|
||||
## `AnimationStyleHelper`
|
||||
@@ -173,6 +172,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `CovertXYAxis` |public void CovertXYAxis(int index)</br>转换X轴和Y轴的配置 |
|
||||
| `GenerateDefaultSerieName` |public string GenerateDefaultSerieName()</br> |
|
||||
| `GetAllSerieDataCount` |public int GetAllSerieDataCount()</br> |
|
||||
| `GetChartBackgroundColor` |public Color32 GetChartBackgroundColor()</br> |
|
||||
| `GetChartComponentNum` |public int GetChartComponentNum(Type type)</br> |
|
||||
| `GetData` |public double GetData(int serieIndex, int dataIndex, int dimension = 1)</br> |
|
||||
| `GetData` |public double GetData(string serieName, int dataIndex, int dimension = 1)</br> |
|
||||
@@ -510,8 +510,6 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
|--|--|
|
||||
| `IsNeedCorner` |public static bool IsNeedCorner(ItemStyle itemStyle)</br> |
|
||||
|
||||
## `LangCandlestick`
|
||||
|
||||
## `LayerHelper`
|
||||
|
||||
|public method|description|
|
||||
@@ -800,7 +798,7 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `AvoidLabelOverlap` |public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)</br> |
|
||||
| `CanShowLabel` |public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)</br> |
|
||||
| `GetLabelColor` |public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)</br> |
|
||||
| `GetRealLabelPosition` |public static Vector3 GetRealLabelPosition(SerieData serieData, LabelStyle label, LabelLine labelLine)</br> |
|
||||
| `GetRealLabelPosition` |public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)</br> |
|
||||
| `SetGaugeLabelText` |public static void SetGaugeLabelText(Serie serie)</br> |
|
||||
| `UpdatePieLabelPosition` |public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)</br> |
|
||||
|
||||
@@ -818,7 +816,6 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `GetLastStackSerie` |public static Serie GetLastStackSerie(List<Serie> series, int index)</br>获得上一个同堆叠且显示的serie。 |
|
||||
| `GetLastStackSerie` |public static Serie GetLastStackSerie(List<Serie> series, Serie serie)</br>获得上一个同堆叠且显示的serie。 |
|
||||
| `GetLegalSerieNameList` |public static List<string> GetLegalSerieNameList(List<Serie> series)</br> |
|
||||
| `GetMaxSerieDataCount` |public static int GetMaxSerieDataCount(List<Serie> series)</br> |
|
||||
@@ -826,8 +823,6 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `GetSerieByVesselIndex` |public static Serie GetSerieByVesselIndex(List<Serie> series, int vesselIndex)</br> |
|
||||
| `GetStackSeries` |public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)</br>获得堆叠系列列表 |
|
||||
| `IsAnyClipSerie` |public static bool IsAnyClipSerie(List<Serie> series)</br>是否有需裁剪的serie。 |
|
||||
| `IsAnyGradientSerie` |public static bool IsAnyGradientSerie(List<Serie> series, string stack)</br>同堆叠的serie是否有渐变色的。 |
|
||||
| `IsAnyUpdateAnimationSerie` |public static bool IsAnyUpdateAnimationSerie(List<Serie> series)</br> |
|
||||
| `IsLegalLegendName` |public static bool IsLegalLegendName(string name)</br> |
|
||||
| `IsStack` |public static bool IsStack(List<Serie> series)</br>是否由数据堆叠 |
|
||||
| `UpdateSerieNameList` |public static void UpdateSerieNameList(BaseChart chart, ref List<string> serieNameList)</br>获得所有系列名,不包含空名字。 |
|
||||
@@ -978,7 +973,7 @@ Inherits or Implemented: [MainComponentContext](#MainComponentContext)
|
||||
| `RemoveAllChartObject` |public static void RemoveAllChartObject()</br> |
|
||||
| `RemoveChart` |public static void RemoveChart(string chartName)</br> |
|
||||
|
||||
## `XChartsPackageResourceImporterWindow`
|
||||
## `XCResourceImporterWindow`
|
||||
|
||||
Inherits or Implemented: [UnityEditor.EditorWindow](#UnityEditor.EditorWindow)
|
||||
|
||||
@@ -1007,4 +1002,4 @@ Inherits or Implemented: [UnityEditor.EditorWindow](#UnityEditor.EditorWindow)
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts Configuration](XChartsConfiguration-EN.md)</br>
|
||||
[XCharts Q&A](XChartsFQA-EN.md)
|
||||
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)
|
||||
[XCharts问答](XChartsFAQ-ZH.md)
|
||||
|
||||
## Class
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
- [HeatmapChart](#HeatmapChart)
|
||||
- [InteractData](#InteractData)
|
||||
- [ItemStyleHelper](#ItemStyleHelper)
|
||||
- [LangCandlestick](#LangCandlestick)
|
||||
- [LayerHelper](#LayerHelper)
|
||||
- [LegendContext](#LegendContext)
|
||||
- [LegendHelper](#LegendHelper)
|
||||
@@ -93,7 +92,7 @@
|
||||
- [VisualMapContext](#VisualMapContext)
|
||||
- [VisualMapHelper](#VisualMapHelper)
|
||||
- [XChartsMgr](#XChartsMgr)
|
||||
- [XChartsPackageResourceImporterWindow](#XChartsPackageResourceImporterWindow)
|
||||
- [XCResourceImporterWindow](#XCResourceImporterWindow)
|
||||
- [XCThemeMgr](#XCThemeMgr)
|
||||
|
||||
## `AnimationStyleHelper`
|
||||
@@ -173,6 +172,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `CovertXYAxis` |public void CovertXYAxis(int index)</br>转换X轴和Y轴的配置 |
|
||||
| `GenerateDefaultSerieName` |public string GenerateDefaultSerieName()</br> |
|
||||
| `GetAllSerieDataCount` |public int GetAllSerieDataCount()</br> |
|
||||
| `GetChartBackgroundColor` |public Color32 GetChartBackgroundColor()</br> |
|
||||
| `GetChartComponentNum` |public int GetChartComponentNum(Type type)</br> |
|
||||
| `GetData` |public double GetData(int serieIndex, int dataIndex, int dimension = 1)</br> |
|
||||
| `GetData` |public double GetData(string serieName, int dataIndex, int dimension = 1)</br> |
|
||||
@@ -510,8 +510,6 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
|--|--|
|
||||
| `IsNeedCorner` |public static bool IsNeedCorner(ItemStyle itemStyle)</br> |
|
||||
|
||||
## `LangCandlestick`
|
||||
|
||||
## `LayerHelper`
|
||||
|
||||
|public method|description|
|
||||
@@ -800,7 +798,7 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `AvoidLabelOverlap` |public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)</br> |
|
||||
| `CanShowLabel` |public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)</br> |
|
||||
| `GetLabelColor` |public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)</br> |
|
||||
| `GetRealLabelPosition` |public static Vector3 GetRealLabelPosition(SerieData serieData, LabelStyle label, LabelLine labelLine)</br> |
|
||||
| `GetRealLabelPosition` |public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)</br> |
|
||||
| `SetGaugeLabelText` |public static void SetGaugeLabelText(Serie serie)</br> |
|
||||
| `UpdatePieLabelPosition` |public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)</br> |
|
||||
|
||||
@@ -818,7 +816,6 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
|
||||
|public method|description|
|
||||
|--|--|
|
||||
| `GetLastStackSerie` |public static Serie GetLastStackSerie(List<Serie> series, int index)</br>获得上一个同堆叠且显示的serie。 |
|
||||
| `GetLastStackSerie` |public static Serie GetLastStackSerie(List<Serie> series, Serie serie)</br>获得上一个同堆叠且显示的serie。 |
|
||||
| `GetLegalSerieNameList` |public static List<string> GetLegalSerieNameList(List<Serie> series)</br> |
|
||||
| `GetMaxSerieDataCount` |public static int GetMaxSerieDataCount(List<Serie> series)</br> |
|
||||
@@ -826,8 +823,6 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `GetSerieByVesselIndex` |public static Serie GetSerieByVesselIndex(List<Serie> series, int vesselIndex)</br> |
|
||||
| `GetStackSeries` |public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)</br>获得堆叠系列列表 |
|
||||
| `IsAnyClipSerie` |public static bool IsAnyClipSerie(List<Serie> series)</br>是否有需裁剪的serie。 |
|
||||
| `IsAnyGradientSerie` |public static bool IsAnyGradientSerie(List<Serie> series, string stack)</br>同堆叠的serie是否有渐变色的。 |
|
||||
| `IsAnyUpdateAnimationSerie` |public static bool IsAnyUpdateAnimationSerie(List<Serie> series)</br> |
|
||||
| `IsLegalLegendName` |public static bool IsLegalLegendName(string name)</br> |
|
||||
| `IsStack` |public static bool IsStack(List<Serie> series)</br>是否由数据堆叠 |
|
||||
| `UpdateSerieNameList` |public static void UpdateSerieNameList(BaseChart chart, ref List<string> serieNameList)</br>获得所有系列名,不包含空名字。 |
|
||||
@@ -978,7 +973,7 @@ Inherits or Implemented: [MainComponentContext](#MainComponentContext)
|
||||
| `RemoveAllChartObject` |public static void RemoveAllChartObject()</br> |
|
||||
| `RemoveChart` |public static void RemoveChart(string chartName)</br> |
|
||||
|
||||
## `XChartsPackageResourceImporterWindow`
|
||||
## `XCResourceImporterWindow`
|
||||
|
||||
Inherits or Implemented: [UnityEditor.EditorWindow](#UnityEditor.EditorWindow)
|
||||
|
||||
@@ -1007,4 +1002,4 @@ Inherits or Implemented: [UnityEditor.EditorWindow](#UnityEditor.EditorWindow)
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)
|
||||
[XCharts问答](XChartsFAQ-ZH.md)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts API](XChartsAPI-EN.md)</br>
|
||||
[XCharts Q&A](XChartsFQA-EN.md)
|
||||
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||
|
||||
## Serie
|
||||
|
||||
@@ -22,6 +22,25 @@
|
||||
- [SimplifiedCandlestick](#SimplifiedCandlestick)
|
||||
- [SimplifiedLine](#SimplifiedLine)
|
||||
|
||||
## Theme
|
||||
|
||||
- [AngleAxisTheme](#AngleAxisTheme)
|
||||
- [AxisTheme](#AxisTheme)
|
||||
- [BaseAxisTheme](#BaseAxisTheme)
|
||||
- [ComponentTheme](#ComponentTheme)
|
||||
- [DataZoomTheme](#DataZoomTheme)
|
||||
- [LegendTheme](#LegendTheme)
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [Theme](#Theme)
|
||||
- [ThemeStyle](#ThemeStyle)
|
||||
- [TitleTheme](#TitleTheme)
|
||||
- [TooltipTheme](#TooltipTheme)
|
||||
- [VisualMapTheme](#VisualMapTheme)
|
||||
|
||||
## MainComponent
|
||||
|
||||
- [AngleAxis](#AngleAxis)
|
||||
@@ -125,9 +144,9 @@
|
||||
- [DebugInfo](#DebugInfo)
|
||||
- [Indicator](#Indicator)
|
||||
- [Lang](#Lang)
|
||||
- [LangCandlestick](#LangCandlestick)
|
||||
- [LangTime](#LangTime)
|
||||
- [MainComponent](#MainComponent)
|
||||
- [Theme](#Theme)
|
||||
- [XCResourcesImporter](#XCResourcesImporter)
|
||||
- [XCSettings](#XCSettings)
|
||||
|
||||
@@ -430,7 +449,7 @@ DataZoom component is used for zooming a specific area, which enables user to in
|
||||
| `filterMode` | | The mode of data filter.</br>`DataZoom.FilterMode`:</br>- `Filter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered if one of the relevant dimensions is out of the window.</br>- `WeakFilter`: data that outside the window will be filtered, which may lead to some changes of windows of other axes. For each data item, it will be filtered only if all of the relevant dimensions are out of the same side of the window.</br>- `Empty`: data that outside the window will be set to NaN, which will not lead to changes of windows of other axes.</br>- `None`: Do not filter data.</br>|
|
||||
| `xAxisIndexs` | | Specify which xAxis is controlled by the dataZoom. |
|
||||
| `yAxisIndexs` | | Specify which yAxis is controlled by the dataZoom. |
|
||||
| `supportInside` | | Whether built-in support is supported. |
|
||||
| `supportInside` | | Whether built-in support is supported. Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging, mouse wheel, finger swiping (on the touch screen). |
|
||||
| `supportInsideScroll` |true | 是否支持坐标系内滚动 |
|
||||
| `supportInsideDrag` |true | 是否支持坐标系内拖拽 |
|
||||
| `supportSlider` | | Whether a slider is supported. There are separate sliders on which the user zooms or roams. |
|
||||
@@ -449,7 +468,7 @@ DataZoom component is used for zooming a specific area, which enables user to in
|
||||
| `bottom` | | Distance between dataZoom component and the bottom side of the container. bottom value is a instant pixel value like 10 or float value [0-1]. |
|
||||
| `rangeMode` | | Use absolute value or percent value in DataZoom.start and DataZoom.end.</br>`DataZoom.RangeMode`:</br>- `//Value`: The value type of start and end.取值类型</br>- `Percent`: percent value.</br>|
|
||||
| `start` | | The start percentage of the window out of the data extent, in the range of 0 ~ 100. |
|
||||
| `end` | | The end percentage of the window out of the data extent, in the range of 0 ~ 100. 数据窗口范围的结束百分比。范围是:0 ~ 100。 |
|
||||
| `end` | | The end percentage of the window out of the data extent, in the range of 0 ~ 100. |
|
||||
| `startValue` | | |
|
||||
| `endValue` | | |
|
||||
| `minShowNum` |1 | Minimum number of display data. Minimum number of data displayed when DataZoom is enlarged to maximum. |
|
||||
@@ -634,7 +653,6 @@ Text label of chart, to explain some data information about graphic item like va
|
||||
| `backgroundHeight` |0 | the height of background. If set as default value 0, it means than the background height auto set as the text height. |
|
||||
| `numericFormatter` | | Standard numeric format strings. |
|
||||
| `autoOffset` |false | 是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会根据已支持的serie自动设置颜色。 |
|
||||
| `textStyle` | | the sytle of text. [TextStyle](TextStyle)|
|
||||
|
||||
## `Lang`
|
||||
@@ -644,6 +662,9 @@ Inherits or Implemented: [ScriptableObject](#ScriptableObject)
|
||||
Language.
|
||||
|
||||
|
||||
## `LangCandlestick`
|
||||
|
||||
|
||||
## `LangTime`
|
||||
|
||||
|
||||
@@ -709,7 +730,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` | | Whether to show the arrow. |
|
||||
| `Position` | | |
|
||||
| `position` | | The position of arrow.</br>`LineArrow.Position`:</br>- `End`: 末端箭头</br>- `Start`: 头端箭头</br>|
|
||||
| `arrow` | | the arrow of line. [ArrowStyle](ArrowStyle)|
|
||||
|
||||
## `LineStyle`
|
||||
@@ -843,9 +864,9 @@ Polar coordinate can be used in scatter and line chart. Every polar coordinate h
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | Whether to show the polor component. |
|
||||
| `center` | | [default:[0.5f,0.45f]]The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate. |
|
||||
| `radius` |0.35f | [default:0.35f]the radius of polar. |
|
||||
| `backgroundColor` | | [default:Color.clear]Background color of polar, which is transparent by default. |
|
||||
| `center` | | The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate. When value between 0 and 1 represents a percentage relative to the chart. |
|
||||
| `radius` |0.35f | the radius of polar. |
|
||||
| `backgroundColor` | | Background color of polar, which is transparent by default. |
|
||||
|
||||
## `Radar`
|
||||
|
||||
@@ -1138,6 +1159,7 @@ Settings related to text.
|
||||
| `rotate` |0 | Rotation of text. |
|
||||
| `extraWidth` |0 | Extra width of text preferred width. |
|
||||
| `offset` |Vector2.zero | the offset of position. |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会自动设置颜色。 |
|
||||
| `color` | | the color of text. |
|
||||
| `autoBackgroundColor` |false | |
|
||||
| `backgroundColor` | | the color of text. |
|
||||
@@ -1184,7 +1206,8 @@ Theme.
|
||||
|--|--|--|
|
||||
| `show` |true | |
|
||||
| `sharedTheme` | | [Theme](Theme)|
|
||||
| `enableCustomTheme` | | |
|
||||
| `transparentBackground` |false | Whether the background color is transparent. When true, the background color is not drawn. |是否透明背景颜色。当设置为true时,不绘制背景颜色。 |
|
||||
| `enableCustomTheme` |false | Whether to customize theme colors. When set to true, you can use 'sync color to custom' to synchronize the theme color to the custom color. It can also be set manually. |
|
||||
| `customFont` | | |
|
||||
| `customBackgroundColor` | | the custom background color of chart. |
|
||||
| `customColorPalette` | | |
|
||||
@@ -1394,4 +1417,4 @@ The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts API](XChartsAPI-EN.md)</br>
|
||||
[XCharts Q&A](XChartsFQA-EN.md)
|
||||
[XCharts FAQ](XChartsFAQ-EN.md)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)
|
||||
[XCharts问答](XChartsFAQ-ZH.md)
|
||||
|
||||
## Serie 系列
|
||||
|
||||
@@ -22,6 +22,25 @@
|
||||
- [SimplifiedCandlestick](#SimplifiedCandlestick)
|
||||
- [SimplifiedLine](#SimplifiedLine)
|
||||
|
||||
## Theme 主题
|
||||
|
||||
- [AngleAxisTheme](#AngleAxisTheme)
|
||||
- [AxisTheme](#AxisTheme)
|
||||
- [BaseAxisTheme](#BaseAxisTheme)
|
||||
- [ComponentTheme](#ComponentTheme)
|
||||
- [DataZoomTheme](#DataZoomTheme)
|
||||
- [LegendTheme](#LegendTheme)
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [Theme](#Theme)
|
||||
- [ThemeStyle](#ThemeStyle)
|
||||
- [TitleTheme](#TitleTheme)
|
||||
- [TooltipTheme](#TooltipTheme)
|
||||
- [VisualMapTheme](#VisualMapTheme)
|
||||
|
||||
## MainComponent 主组件
|
||||
|
||||
- [AngleAxis](#AngleAxis)
|
||||
@@ -125,9 +144,9 @@
|
||||
- [DebugInfo](#DebugInfo)
|
||||
- [Indicator](#Indicator)
|
||||
- [Lang](#Lang)
|
||||
- [LangCandlestick](#LangCandlestick)
|
||||
- [LangTime](#LangTime)
|
||||
- [MainComponent](#MainComponent)
|
||||
- [Theme](#Theme)
|
||||
- [XCResourcesImporter](#XCResourcesImporter)
|
||||
- [XCSettings](#XCSettings)
|
||||
|
||||
@@ -422,7 +441,7 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
|
||||
Inherits or Implemented: [MainComponent](#MainComponent),[IUpdateRuntimeData](#IUpdateRuntimeData)
|
||||
|
||||
<para>DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。</para>
|
||||
DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。
|
||||
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
@@ -430,7 +449,7 @@ Inherits or Implemented: [MainComponent](#MainComponent),[IUpdateRuntimeData](#I
|
||||
| `filterMode` | | 数据过滤类型。</br>`DataZoom.FilterMode`:</br>- `Filter`: 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只要有一个维度在数据窗口外,整个数据项就会被过滤掉。</br>- `WeakFilter`: 当前数据窗口外的数据,被 过滤掉。即 会 影响其他轴的数据范围。每个数据项,只有当全部维度都在数据窗口同侧外部,整个数据项才会被过滤掉。</br>- `Empty`: 当前数据窗口外的数据,被 设置为空。即 不会 影响其他轴的数据范围。</br>- `None`: 不过滤数据,只改变数轴范围。</br>|
|
||||
| `xAxisIndexs` | | 控制的 x 轴索引列表。 |
|
||||
| `yAxisIndexs` | | 控制的 y 轴索引列表。 |
|
||||
| `supportInside` | | Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging, mouse wheel, finger swiping (on the touch screen). |
|
||||
| `supportInside` | | 是否支持内置。内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。 |
|
||||
| `supportInsideScroll` |true | 是否支持坐标系内滚动 |
|
||||
| `supportInsideDrag` |true | 是否支持坐标系内拖拽 |
|
||||
| `supportSlider` | | 是否支持滑动条。有单独的滑动条,用户在滑动条上进行缩放或漫游。 |
|
||||
@@ -449,7 +468,7 @@ Inherits or Implemented: [MainComponent](#MainComponent),[IUpdateRuntimeData](#I
|
||||
| `bottom` | | 组件离容器下侧的距离。 |
|
||||
| `rangeMode` | | 取绝对值还是百分比。</br>`DataZoom.RangeMode`:</br>- `//Value`: The value type of start and end.取值类型</br>- `Percent`: 百分比。</br>|
|
||||
| `start` | | 数据窗口范围的起始百分比。范围是:0 ~ 100。 |
|
||||
| `end` | | The end percentage of the window out of the data extent, in the range of 0 ~ 100. 数据窗口范围的结束百分比。范围是:0 ~ 100。 |
|
||||
| `end` | | 数据窗口范围的结束百分比。范围是:0 ~ 100。 |
|
||||
| `startValue` | | |
|
||||
| `endValue` | | |
|
||||
| `minShowNum` |1 | 最小显示数据个数。当DataZoom放大到最大时,最小显示的数据个数。 |
|
||||
@@ -634,7 +653,6 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
| `backgroundHeight` |0 | 标签的背景高度。一般不用指定,不指定时则自动是文字的高度。 |
|
||||
| `numericFormatter` | | 标准数字格式字符串。用于将数值格式化显示为字符串。 使用Axx的形式:A是格式说明符的单字符,支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明,从0-99。 参考:https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings |
|
||||
| `autoOffset` |false | 是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会根据已支持的serie自动设置颜色。 |
|
||||
| `textStyle` | | 文本样式。 [TextStyle](TextStyle)|
|
||||
|
||||
## `Lang`
|
||||
@@ -644,6 +662,9 @@ Inherits or Implemented: [ScriptableObject](#ScriptableObject)
|
||||
国际化语言表。
|
||||
|
||||
|
||||
## `LangCandlestick`
|
||||
|
||||
|
||||
## `LangTime`
|
||||
|
||||
|
||||
@@ -709,7 +730,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` | | 是否显示箭头。 |
|
||||
| `Position` | | |
|
||||
| `position` | | 箭头位置。</br>`LineArrow.Position`:</br>- `End`: 末端箭头</br>- `Start`: 头端箭头</br>|
|
||||
| `arrow` | | 箭头。 [ArrowStyle](ArrowStyle)|
|
||||
|
||||
## `LineStyle`
|
||||
@@ -843,7 +864,7 @@ Inherits or Implemented: [CoordSystem](#CoordSystem),[ISerieContainer](#ISerieCo
|
||||
|field|default|comment|
|
||||
|--|--|--|
|
||||
| `show` |true | 是否显示极坐标。 |
|
||||
| `center` | | When value between 0 and 1 represents a percentage relative to the chart. |
|
||||
| `center` | | 极坐标的中心点。数组的第一项是横坐标,第二项是纵坐标。 当值为0-1之间时表示百分比,设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度。 |
|
||||
| `radius` |0.35f | 极坐标的半径。 |
|
||||
| `backgroundColor` | | 极坐标的背景色,默认透明。 |
|
||||
|
||||
@@ -1138,6 +1159,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
| `rotate` |0 | 文本的旋转。 [default: `0f`] |
|
||||
| `extraWidth` |0 | 额外的宽度 |
|
||||
| `offset` |Vector2.zero | 坐标偏移。 [Default: `Vector2.zero`] |
|
||||
| `autoColor` |false | 是否开启自动颜色。当开启时,会自动设置颜色。 |
|
||||
| `color` | | 文本的颜色。 [default: `Color.clear`] |
|
||||
| `autoBackgroundColor` |false | |
|
||||
| `backgroundColor` | | 文本的背景颜色。 [default: `Color.clear`] |
|
||||
@@ -1184,7 +1206,8 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|--|--|--|
|
||||
| `show` |true | |
|
||||
| `sharedTheme` | | [Theme](Theme)|
|
||||
| `enableCustomTheme` | | |
|
||||
| `transparentBackground` |false | Whether the background color is transparent. When true, the background color is not drawn. |是否透明背景颜色。当设置为true时,不绘制背景颜色。 |
|
||||
| `enableCustomTheme` |false | 是否自定义主题颜色。当设置为true时,可以用‘sync color to custom’同步主题的颜色到自定义颜色。也可以手动设置。 |
|
||||
| `customFont` | | |
|
||||
| `customBackgroundColor` | | 自定义的背景颜色。 |
|
||||
| `customColorPalette` | | |
|
||||
@@ -1394,4 +1417,4 @@ Inherits or Implemented: [Axis](#Axis)
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)
|
||||
[XCharts问答](XChartsFAQ-ZH.md)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# XCharts Q&A
|
||||
# XCharts FAQ
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts API](XChartsAPI-EN.md)</br>
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2929481916a9540ed9ecc270be6a3b0e
|
||||
guid: e803ae0ae73794ec6891fed7551fe01d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2d61cadf902a4e20a2690f3c7d2ceea
|
||||
guid: 4df833a2a1e6c4a7da37a08379dd2e18
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -1,7 +1,7 @@
|
||||
# 教程:5分钟上手 XCharts 3.0
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -226,6 +226,6 @@ itemStyle.color = Color.blue;
|
||||
```
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 教程:5分钟上手 XCharts 3.0
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -226,6 +226,6 @@ itemStyle.color = Color.blue;
|
||||
```
|
||||
|
||||
[XCharts主页](https://github.com/XCharts-Team/XCharts)</br>
|
||||
[XCharts问答](XChartsFQA-ZH.md)</br>
|
||||
[XCharts问答](XChartsFAQ-ZH.md)</br>
|
||||
[XChartsAPI接口](XChartsAPI-ZH.md)</br>
|
||||
[XCharts配置项手册](XChartsConfiguration-ZH.md)
|
||||
|
||||
@@ -11,6 +11,15 @@ namespace XCharts.Editor
|
||||
[CustomEditor(typeof(BaseChart), true)]
|
||||
public class BaseChartEditor : UnityEditor.Editor
|
||||
{
|
||||
class Styles
|
||||
{
|
||||
public static readonly GUIContent btnAddSerie = new GUIContent("Add Serie", "");
|
||||
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
|
||||
public static readonly GUIContent btnCovertXYAxis = new GUIContent("Covert XY Axis", "");
|
||||
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Chart Object", "");
|
||||
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
|
||||
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
|
||||
}
|
||||
protected BaseChart m_Chart;
|
||||
protected SerializedProperty m_Script;
|
||||
protected SerializedProperty m_EnableTextMeshPro;
|
||||
@@ -28,6 +37,7 @@ namespace XCharts.Editor
|
||||
private bool m_CheckWarning = false;
|
||||
private int m_LastComponentCount = 0;
|
||||
private int m_LastSerieCount = 0;
|
||||
private string m_VersionString = "";
|
||||
private StringBuilder sb = new StringBuilder();
|
||||
MainComponentListEditor m_ComponentList;
|
||||
SerieListEditor m_SerieList;
|
||||
@@ -51,6 +61,10 @@ namespace XCharts.Editor
|
||||
RefreshSeries();
|
||||
m_SerieList = new SerieListEditor(this);
|
||||
m_SerieList.Init(m_Chart, serializedObject, m_Series);
|
||||
|
||||
m_VersionString = "v" + XChartsMgr.fullVersion;
|
||||
if (m_EnableTextMeshPro.boolValue)
|
||||
m_VersionString += "-tmp";
|
||||
}
|
||||
|
||||
public List<SerializedProperty> RefreshComponent()
|
||||
@@ -97,8 +111,6 @@ namespace XCharts.Editor
|
||||
m_SerieList.UpdateSeriesProperty(m_Series);
|
||||
}
|
||||
OnStartInspectorGUI();
|
||||
EditorGUILayout.Space();
|
||||
|
||||
OnDebugInspectorGUI();
|
||||
EditorGUILayout.Space();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
@@ -113,18 +125,23 @@ namespace XCharts.Editor
|
||||
EditorGUILayout.PropertyField(m_Script);
|
||||
EditorGUILayout.PropertyField(m_ChartName);
|
||||
EditorGUILayout.PropertyField(m_RaycastTarget);
|
||||
if (XChartsMgr.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox("chart name is repeated: " + m_ChartName.stringValue, MessageType.Error);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.PropertyField(m_Theme);
|
||||
EditorGUILayout.PropertyField(m_Settings);
|
||||
|
||||
m_ComponentList.OnGUI();
|
||||
|
||||
m_SerieList.OnGUI();
|
||||
}
|
||||
|
||||
protected virtual void OnDebugInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_DebugInfo, true);
|
||||
EditorGUILayout.Space();
|
||||
AddSerie();
|
||||
AddComponent();
|
||||
CheckWarning();
|
||||
@@ -165,16 +182,12 @@ namespace XCharts.Editor
|
||||
|
||||
private void ShowVersion()
|
||||
{
|
||||
sb.Length = 0;
|
||||
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
|
||||
if(m_EnableTextMeshPro.boolValue)
|
||||
sb.Append("-tmp");
|
||||
EditorGUILayout.HelpBox(sb.ToString(), MessageType.None);
|
||||
EditorGUILayout.HelpBox(m_VersionString, MessageType.None);
|
||||
}
|
||||
|
||||
private void AddComponent()
|
||||
{
|
||||
if (GUILayout.Button("Add Component"))
|
||||
if (GUILayout.Button(Styles.btnAddComponent))
|
||||
{
|
||||
var menu = new GenericMenu();
|
||||
foreach (var type in GetMainComponentTypeNames())
|
||||
@@ -197,7 +210,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
private void AddSerie()
|
||||
{
|
||||
if (GUILayout.Button("Add Serie"))
|
||||
if (GUILayout.Button(Styles.btnAddSerie))
|
||||
{
|
||||
var menu = new GenericMenu();
|
||||
foreach (var type in GetSerieTypeNames())
|
||||
@@ -260,22 +273,22 @@ namespace XCharts.Editor
|
||||
{
|
||||
if (m_Chart.HasChartComponent<XAxis>() && m_Chart.HasChartComponent<YAxis>())
|
||||
{
|
||||
if (GUILayout.Button("Covert XY Axis"))
|
||||
if (GUILayout.Button(Styles.btnCovertXYAxis))
|
||||
m_Chart.CovertXYAxis(0);
|
||||
}
|
||||
if (GUILayout.Button("Rebuild Chart Object"))
|
||||
if (GUILayout.Button(Styles.btnRebuildChartObject))
|
||||
{
|
||||
m_Chart.RebuildChartObject();
|
||||
}
|
||||
if (m_CheckWarning)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Check Warning"))
|
||||
if (GUILayout.Button(Styles.btnCheckWarning))
|
||||
{
|
||||
m_CheckWarning = true;
|
||||
m_Chart.CheckWarning();
|
||||
}
|
||||
if (GUILayout.Button("Hide Warning"))
|
||||
if (GUILayout.Button(Styles.btnHideWarning))
|
||||
{
|
||||
m_CheckWarning = false;
|
||||
}
|
||||
@@ -296,7 +309,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GUILayout.Button("Check warning"))
|
||||
if (GUILayout.Button(Styles.btnCheckWarning))
|
||||
{
|
||||
m_CheckWarning = true;
|
||||
m_Chart.CheckWarning();
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Position");
|
||||
PropertyField(prop, "m_Offset");
|
||||
PropertyField(prop, "m_AutoOffset");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_Formatter");
|
||||
PropertyField(prop, "m_NumericFormatter");
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Rotate");
|
||||
PropertyField(prop, "m_Offset");
|
||||
PropertyField(prop, "m_ExtraWidth");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_AutoBackgroundColor");
|
||||
PropertyField(prop, "m_BackgroundColor");
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace XCharts.Editor
|
||||
XCThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
|
||||
}
|
||||
PropertyField(prop, "m_SharedTheme");
|
||||
PropertyField(prop, "m_TransparentBackground");
|
||||
PropertyField(prop, "m_EnableCustomTheme");
|
||||
using (new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Gap");
|
||||
PropertyTwoFiled("m_Center");
|
||||
PropertyTwoFiled("m_Radius");
|
||||
//PropertyField("m_StartAngle");
|
||||
|
||||
PropertyFiledMore(() =>
|
||||
{
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace XCharts.Editor
|
||||
public static void CheckDeletedAsset(string assetPath)
|
||||
{
|
||||
if (!IsThemeAsset(assetPath)) return;
|
||||
if (XCSettings.Instance == null) return;
|
||||
var themes = XCSettings.customThemes;
|
||||
var changed = false;
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ namespace XCharts.Editor
|
||||
static SettingsProvider[] CreateXCSettingsProvider()
|
||||
{
|
||||
var providers = new System.Collections.Generic.List<SettingsProvider> { new XCResourceImporterProvider() };
|
||||
|
||||
if (GetSettings() != null)
|
||||
{
|
||||
var provider = new AssetSettingsProvider("Project/XCharts/Settings", GetSettings);
|
||||
|
||||
@@ -193,20 +193,5 @@ namespace XCharts.Editor
|
||||
XChartsMgr.ModifyTMPRefence(true);
|
||||
XChartsMgr.DisableTextMeshPro();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/Theme/Export Default Theme")]
|
||||
public static void ExportDefaultTheme()
|
||||
{
|
||||
var profile = ScriptableObject.CreateInstance<Theme>();
|
||||
profile.name = "Default";
|
||||
profile.themeName = "Default";
|
||||
profile.themeType = ThemeType.Default;
|
||||
|
||||
var themeName = XCSettings.THEME_ASSET_NAME_PREFIX + profile.themeName;
|
||||
var path = XCSettings.THEME_ASSET_FOLDER + "/" + themeName + ".asset";
|
||||
AssetDatabase.CreateAsset(profile, path);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
78
README.md
78
README.md
@@ -47,60 +47,68 @@
|
||||
|
||||
[XCharts3.0 教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
[XCharts3.0 API](Documentation/XChartsAPI-ZH.md)
|
||||
[XCharts3.0 问答](Documentation/XChartsFQA-ZH.md)
|
||||
[XCharts3.0 问答](Documentation/XChartsFAQ-ZH.md)
|
||||
[XCharts3.0 配置项手册](Documentation/XChartsConfiguration-ZH.md)
|
||||
[XCharts3.0 更新日志](CHANGELOG.md)
|
||||
|
||||
## 特性
|
||||
|
||||
* 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
||||
* 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
||||
* 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||
* 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
||||
* 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
||||
* 支持环形图、玫瑰图等饼图。
|
||||
* 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
|
||||
* 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
||||
* 支持主题定制、导入和导出,内置两种默认主题。
|
||||
* 支持自定义图表内容绘制,提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
|
||||
* 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
|
||||
* 支持万级大数据绘制。
|
||||
* 支持`TexMeshPro`。
|
||||
- 参数可视化配置,效果实时预览,纯代码绘制,无需额外资源。
|
||||
- 支持折线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等十种常见免费内置图表。
|
||||
- 支持3D柱图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种付费扩展图表。
|
||||
- 支持直线图、曲线图、面积图、阶梯线图等折线图。
|
||||
- 支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图等柱状图。
|
||||
- 支持环形图、玫瑰图等饼图。
|
||||
- 支持内置图表的任意组合,同一图表中可同时显示多个相同或不同类型的图表。
|
||||
- 支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
||||
- 支持主题定制、导入和导出,内置两种默认主题。
|
||||
- 支持自定义图表内容绘制,提供绘制点、直线、曲线、三角形、四边形、圆形、环形、扇形、边框、箭头等强大的绘图API。
|
||||
- 支持PC端和手机端上的数据筛选、视图缩放、细节展示等交互操作。
|
||||
- 支持万级大数据绘制。
|
||||
- 支持`TexMeshPro`。
|
||||
|
||||
## XCharts3.0 比 2.0 的改进
|
||||
## XCharts3.0 相比XCharts2.0 的改进
|
||||
|
||||
* 更健壮的底层框架。
|
||||
* 更小的序列化文件。
|
||||
* 更强大的性能。
|
||||
* 更好的交互体验。
|
||||
* 更多的组件支持。
|
||||
* 更合理的组件调整。
|
||||
* 更灵活的组件插拔。
|
||||
* 更方便的二次开发。
|
||||
* 更丰富的Demo示例。
|
||||
- 更健壮的底层框架。
|
||||
- 更小的序列化文件。
|
||||
- 更强大的性能。
|
||||
- 更好的交互体验。
|
||||
- 更多的组件支持。
|
||||
- 更合理的组件调整。
|
||||
- 更灵活的组件插拔。
|
||||
- 更方便的二次开发。
|
||||
- 更丰富的Demo示例。
|
||||
|
||||
## XCharts3.0 新功能
|
||||
|
||||
* 增加Time时间轴。
|
||||
* 增加SingleAxis单轴。
|
||||
* 增加多种坐标系:Grid、Polar、Radar、SingleAxis。
|
||||
* 增加多种动画方式。
|
||||
* 增加多种图表交互。
|
||||
* 增加国际化支持。
|
||||
* 增加Widgets小组件。
|
||||
* 增加多种扩展图表。
|
||||
- 增加Time时间轴。
|
||||
- 增加SingleAxis单轴。
|
||||
- 增加多种坐标系:Grid、Polar、Radar、SingleAxis。
|
||||
- 增加多种动画方式。
|
||||
- 增加多种图表交互。
|
||||
- 增加国际化支持。
|
||||
- 增加Widgets小组件。
|
||||
- 增加多种扩展图表。
|
||||
|
||||
## 注意
|
||||
|
||||
- XCharts3.0 不兼容 XCharts2.0 版本,建议旧项目还是继续使用XCharts2.0,新项目使用XCharts3.0。
|
||||
- XCharts2.0 进入维护阶段,后续只修复严重bug理论上不再加新功能。
|
||||
- XCharts 理论上支持Unity 5.6及以上版本,但由于版本测试有限难免疏漏,发现版本兼容问题可提Issue。
|
||||
- XCharts 内置图表都为常见的图表,可以免费使用;扩展图表大部分为不常使用的图表,有需要的可付费获取,感谢对XCharts的支持。
|
||||
- 本仓库只包含XCharts源码,不包含Demo示例部分。需要查看Demo示例请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)
|
||||
|
||||
## 截图
|
||||
|
||||
[XCharts Demo 项目](https://github.com/XCharts-Team/XCharts-Demo)
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
更多效果请到 [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) 查看
|
||||
|
||||
## 使用
|
||||
|
||||
[XCharts教程:5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
[XCharts教程:5分钟上手教程](Documentation/XChartsTutorial01-ZH.md)
|
||||
|
||||
## 日志
|
||||
|
||||
|
||||
@@ -48,10 +48,5 @@ MonoBehaviour:
|
||||
m_PieTooltipExtraRadius: 8
|
||||
m_PieSelectedOffset: 8
|
||||
m_CustomThemes:
|
||||
- {fileID: 0}
|
||||
- {fileID: 11400000, guid: 289d2fc7f4ce24f73b9ed8ec52639f72, type: 2}
|
||||
- {fileID: 11400000, guid: e1dc23a10de1e4c5dbfbaf74c4dfd218, type: 2}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 11400000, guid: 0a4f01779f9b24f48846f968fe013a57, type: 2}
|
||||
- {fileID: 11400000, guid: 4d093c897dc514d12aca94b6b17cb4fa, type: 2}
|
||||
|
||||
@@ -543,7 +543,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
internal void CheckSymbol(float dest)
|
||||
public void CheckSymbol(float dest)
|
||||
{
|
||||
if (!enable || m_IsEnd || m_IsPause || !m_IsInit)
|
||||
return;
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace XCharts.Runtime
|
||||
/// |极坐标系的角度轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(PolarCoord))]
|
||||
[ComponentHandler(typeof(AngleAxisHandler), true)]
|
||||
public class AngleAxis : Axis
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace XCharts.Runtime
|
||||
/// |极坐标系的径向轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(PolarCoord))]
|
||||
[ComponentHandler(typeof(RadiusAxisHandler), true)]
|
||||
public class RadiusAxis : Axis
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void SetDefaultValue()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Show = true;
|
||||
m_Image = null;
|
||||
m_ImageType = Image.Type.Sliced;
|
||||
m_ImageColor = Color.white;
|
||||
|
||||
@@ -33,32 +33,6 @@ namespace XCharts.Runtime
|
||||
component.refreshComponent();
|
||||
}
|
||||
|
||||
//protected void DrawBackground(VertexHelper vh)
|
||||
//{
|
||||
//TODO: CooridateChart
|
||||
// if (SeriesHelper.IsAnyClipSerie(m_Series))
|
||||
// {
|
||||
// var xLineDiff = xAxis0.axisLine.GetWidth(m_Theme.axis.lineWidth);
|
||||
// var yLineDiff = yAxis0.axisLine.GetWidth(m_Theme.axis.lineWidth);
|
||||
// var xSplitDiff = xAxis0.splitLine.GetWidth(m_Theme.axis.splitLineWidth);
|
||||
// var ySplitDiff = yAxis0.splitLine.GetWidth(m_Theme.axis.splitLineWidth);
|
||||
// foreach (var grid in m_Grids)
|
||||
// {
|
||||
// var cpty = grid.context.runtimeY + grid.context.runtimeHeight + ySplitDiff;
|
||||
// var cp1 = new Vector3(grid.context.runtimeX - yLineDiff, grid.context.runtimeY - xLineDiff);
|
||||
// var cp2 = new Vector3(grid.context.runtimeX - yLineDiff, cpty);
|
||||
// var cp3 = new Vector3(grid.context.runtimeX + grid.context.runtimeWidth + xSplitDiff, cpty);
|
||||
// var cp4 = new Vector3(grid.context.runtimeX + grid.context.runtimeWidth + xSplitDiff, grid.context.runtimeY - xLineDiff);
|
||||
// var backgroundColor = ThemeHelper.GetBackgroundColor(m_Theme, m_Background);
|
||||
// UGL.DrawQuadrilateral(vh, cp1, cp2, cp3, cp4, backgroundColor);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// base.DrawBackground(vh);
|
||||
// }
|
||||
// }
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
if (!component.show)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
@@ -69,7 +67,6 @@ namespace XCharts.Runtime
|
||||
End
|
||||
}
|
||||
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] Position m_Position = Position.Outside;
|
||||
[SerializeField] private Vector3 m_Offset;
|
||||
@@ -81,7 +78,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private float m_BackgroundHeight = 0;
|
||||
[SerializeField] private string m_NumericFormatter = "";
|
||||
[SerializeField] private bool m_AutoOffset = false;
|
||||
[SerializeField] private bool m_AutoColor = false;
|
||||
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||
private SerieLabelFormatterFunction m_FormatterFunction;
|
||||
|
||||
@@ -97,7 +94,6 @@ namespace XCharts.Runtime
|
||||
m_BackgroundHeight = 0;
|
||||
m_NumericFormatter = "";
|
||||
m_AutoOffset = false;
|
||||
m_AutoColor = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -211,14 +207,7 @@ namespace XCharts.Runtime
|
||||
get { return m_AutoOffset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoOffset, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否开启自动颜色。当开启时,会根据已支持的serie自动设置颜色。
|
||||
/// </summary>
|
||||
public bool autoColor
|
||||
{
|
||||
get { return m_AutoColor; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoColor, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// the sytle of text.
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace XCharts.Runtime
|
||||
Start
|
||||
}
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] Position m_Position;
|
||||
[SerializeField] private Position m_Position;
|
||||
[SerializeField]
|
||||
private ArrowStyle m_Arrow = new ArrowStyle()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private float m_Rotate = 0;
|
||||
[SerializeField] private float m_ExtraWidth = 0;
|
||||
[SerializeField] private Vector2 m_Offset = Vector2.zero;
|
||||
[SerializeField] private bool m_AutoColor = false;
|
||||
[SerializeField] private Color m_Color = Color.clear;
|
||||
[SerializeField] private bool m_AutoBackgroundColor = false;
|
||||
[SerializeField] private Color m_BackgroundColor = Color.clear;
|
||||
@@ -61,9 +62,15 @@ namespace XCharts.Runtime
|
||||
get { return m_Offset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
public Vector3 offsetv3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启自动颜色。当开启时,会自动设置颜色。
|
||||
/// </summary>
|
||||
public bool autoColor
|
||||
{
|
||||
get { return m_AutoColor; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoColor, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of text.
|
||||
/// |文本的颜色。
|
||||
@@ -207,7 +214,9 @@ namespace XCharts.Runtime
|
||||
font = textStyle.font;
|
||||
rotate = textStyle.rotate;
|
||||
offset = textStyle.offset;
|
||||
autoColor = textStyle.autoColor;
|
||||
color = textStyle.color;
|
||||
autoBackgroundColor = textStyle.autoBackgroundColor;
|
||||
backgroundColor = textStyle.backgroundColor;
|
||||
fontSize = textStyle.fontSize;
|
||||
fontStyle = textStyle.fontStyle;
|
||||
@@ -251,5 +260,13 @@ namespace XCharts.Runtime
|
||||
{
|
||||
return m_AutoAlign ? systemAlignment : alignment;
|
||||
}
|
||||
|
||||
public Color32 GetBackgroundColor(Color32 chartBackgroundColor)
|
||||
{
|
||||
if (m_AutoColor || ChartHelper.IsClearColor(m_BackgroundColor))
|
||||
return chartBackgroundColor;
|
||||
else
|
||||
return m_BackgroundColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ namespace XCharts.Runtime
|
||||
/// DataZoom component is used for zooming a specific area,
|
||||
/// which enables user to investigate data in detail,
|
||||
/// or get an overview of the data, or get rid of outlier points.
|
||||
/// |
|
||||
/// <para>DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。</para>
|
||||
/// |DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[ComponentHandler(typeof(DataZoomHandler), true)]
|
||||
@@ -132,7 +131,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether built-in support is supported.
|
||||
/// |Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging,
|
||||
/// Built into the coordinate system to allow the user to zoom in and out of the coordinate system by mouse dragging,
|
||||
/// mouse wheel, finger swiping (on the touch screen).
|
||||
/// |是否支持内置。内置于坐标系中,使用户可以在坐标系上通过鼠标拖拽、鼠标滚轮、手指滑动(触屏上)来缩放或漫游坐标系。
|
||||
/// </summary>
|
||||
@@ -303,7 +302,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The end percentage of the window out of the data extent, in the range of 0 ~ 100.
|
||||
/// 数据窗口范围的结束百分比。范围是:0 ~ 100。
|
||||
/// |数据窗口范围的结束百分比。范围是:0 ~ 100。
|
||||
/// </summary>
|
||||
public float end
|
||||
{
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace XCharts.Runtime
|
||||
UGL.DrawDiamond(vh, rect.center, radius, color);
|
||||
break;
|
||||
case Legend.Type.EmptyCircle:
|
||||
var backgroundColor = chart.theme.GetBackgroundColor(chart.GetChartComponent<Background>());
|
||||
var backgroundColor = chart.GetChartBackgroundColor();
|
||||
UGL.DrawEmptyCricle(vh, rect.center, radius, 2 * chart.settings.legendIconLineWidth,
|
||||
color, color, backgroundColor, 1f);
|
||||
break;
|
||||
|
||||
@@ -78,12 +78,14 @@ namespace XCharts.Runtime
|
||||
var element = ChartHelper.AddSerieLabel(textName, m_MarkLineLabelRoot.transform, label.backgroundWidth,
|
||||
label.backgroundHeight, color, label.textStyle, chart.theme);
|
||||
var isAutoSize = label.backgroundWidth == 0 || label.backgroundHeight == 0;
|
||||
var backgroundColor = label.textStyle.GetBackgroundColor(chart.GetChartBackgroundColor());
|
||||
var item = ChartHelper.GetOrAddComponent<ChartLabel>(element);
|
||||
item.SetLabel(element, isAutoSize, label.paddingLeftRight, label.paddingTopBottom);
|
||||
item.SetIconActive(false);
|
||||
item.SetActive(data.label.show);
|
||||
item.SetPosition(MarkLineHelper.GetLabelPosition(data));
|
||||
item.SetText(MarkLineHelper.GetFormatterContent(serie, data));
|
||||
item.color = backgroundColor;
|
||||
data.runtimeLabel = item;
|
||||
};
|
||||
data.refreshComponent();
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[ComponentHandler(typeof(PolarCoordHandler), true)]
|
||||
[RequireChartComponent(typeof(AngleAxis), typeof(RadiusAxis))]
|
||||
public class PolarCoord : CoordSystem, ISerieContainer
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
@@ -32,8 +31,8 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// [default:[0.5f,0.45f]]The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate.
|
||||
/// |When value between 0 and 1 represents a percentage relative to the chart.
|
||||
/// The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate.
|
||||
/// When value between 0 and 1 represents a percentage relative to the chart.
|
||||
/// |极坐标的中心点。数组的第一项是横坐标,第二项是纵坐标。
|
||||
/// 当值为0-1之间时表示百分比,设置成百分比时第一项是相对于容器宽度,第二项是相对于容器高度。
|
||||
/// </summary>
|
||||
@@ -43,7 +42,7 @@ namespace XCharts.Runtime
|
||||
set { if (value != null) { m_Center = value; SetAllDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// [default:0.35f]the radius of polar.
|
||||
/// the radius of polar.
|
||||
/// |极坐标的半径。
|
||||
/// </summary>
|
||||
public float radius
|
||||
@@ -52,7 +51,7 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Radius, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// [default:Color.clear]Background color of polar, which is transparent by default.
|
||||
/// Background color of polar, which is transparent by default.
|
||||
/// |极坐标的背景色,默认透明。
|
||||
/// </summary>
|
||||
public Color backgroundColor
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace XCharts.Runtime
|
||||
public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)
|
||||
{
|
||||
if (serieData.labelObject == null) return;
|
||||
var startAngle = serie.context.startAngle;
|
||||
var currAngle = serieData.context.halfAngle;
|
||||
var currRad = currAngle * Mathf.Deg2Rad;
|
||||
var offsetRadius = serieData.context.offsetRadius;
|
||||
@@ -105,7 +106,7 @@ namespace XCharts.Runtime
|
||||
var currSin = Mathf.Sin(currRad);
|
||||
var currCos = Mathf.Cos(currRad);
|
||||
var pos0 = new Vector3(serie.context.center.x + radius3 * currSin, serie.context.center.y + radius3 * currCos);
|
||||
if (currAngle > 180)
|
||||
if ((currAngle - startAngle) % 360 > 180)
|
||||
{
|
||||
currSin = Mathf.Sin((360 - currAngle) * Mathf.Deg2Rad);
|
||||
currCos = Mathf.Cos((360 - currAngle) * Mathf.Deg2Rad);
|
||||
@@ -113,7 +114,7 @@ namespace XCharts.Runtime
|
||||
var r4 = Mathf.Sqrt(radius1 * radius1 - Mathf.Pow(currCos * radius3, 2)) - currSin * radius3;
|
||||
r4 += labelLine.lineLength1 + labelLine.lineWidth * 4;
|
||||
r4 += serieData.labelObject.label.GetPreferredWidth() / 2;
|
||||
serieData.context.labelPosition = pos0 + (currAngle > 180 ? Vector3.left : Vector3.right) * r4;
|
||||
serieData.context.labelPosition = pos0 + ((currAngle - startAngle) % 360 > 180 ? Vector3.left : Vector3.right) * r4;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -184,11 +185,11 @@ namespace XCharts.Runtime
|
||||
serieData.context.labelPosition = new Vector3(x1, y1);
|
||||
}
|
||||
lastCheckPos = serieData.context.labelPosition;
|
||||
serieData.labelObject.SetPosition(SerieLabelHelper.GetRealLabelPosition(serieData, serieLabel, labelLine));
|
||||
serieData.labelObject.SetPosition(SerieLabelHelper.GetRealLabelPosition(serie, serieData, serieLabel, labelLine));
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3 GetRealLabelPosition(SerieData serieData, LabelStyle label, LabelLine labelLine)
|
||||
public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)
|
||||
{
|
||||
if (label == null || labelLine == null)
|
||||
return serieData.context.labelPosition;
|
||||
@@ -197,7 +198,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var currAngle = serieData.context.halfAngle;
|
||||
var offset = labelLine.lineLength2 + serieData.labelObject.GetLabelWidth() / 2;
|
||||
if (currAngle > 180)
|
||||
if ((currAngle - serie.context.startAngle) % 360 > 180)
|
||||
return serieData.context.labelPosition + new Vector3(-offset, 0, 0);
|
||||
else
|
||||
return serieData.context.labelPosition + new Vector3(offset, 0, 0);
|
||||
|
||||
@@ -58,11 +58,12 @@ namespace XCharts.Runtime
|
||||
{
|
||||
for (int i = 0; i < serie.data.Count; i++)
|
||||
{
|
||||
if (serie is Pie && serie.IsIgnoreValue(serie.data[i])) continue;
|
||||
if (string.IsNullOrEmpty(serie.data[i].name))
|
||||
var serieData = serie.data[i];
|
||||
if (serie is Pie && serie.IsIgnoreValue(serieData)) continue;
|
||||
if (string.IsNullOrEmpty(serieData.name))
|
||||
serieNameList.Add(ChartCached.IntToStr(i));
|
||||
else if (!serieNameList.Contains(serie.data[i].name))
|
||||
serieNameList.Add(serie.data[i].name);
|
||||
else if (!serieNameList.Contains(serieData.name))
|
||||
serieNameList.Add(serieData.name);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -109,26 +110,6 @@ namespace XCharts.Runtime
|
||||
return SerieHelper.GetItemColor(destSerie, destSerieData, chart.theme, index, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同堆叠的serie是否有渐变色的。
|
||||
/// </summary>
|
||||
/// <param name="stack"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsAnyGradientSerie(List<Serie> series, string stack)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stack)) return false;
|
||||
foreach (var serie in series)
|
||||
{
|
||||
if (serie.show && serie.areaStyle != null && serie.areaStyle.show && stack.Equals(serie.stack))
|
||||
{
|
||||
if (!ChartHelper.IsValueEqualsColor(serie.areaStyle.color, serie.areaStyle.toColor)
|
||||
&& !ChartHelper.IsClearColor(serie.areaStyle.toColor))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否有需裁剪的serie。
|
||||
/// </summary>
|
||||
@@ -142,18 +123,6 @@ namespace XCharts.Runtime
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsAnyUpdateAnimationSerie(List<Serie> series)
|
||||
{
|
||||
foreach (var serie in series)
|
||||
{
|
||||
if (serie.animation.enable && serie.animation.dataChangeEnable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得上一个同堆叠且显示的serie。
|
||||
/// </summary>
|
||||
@@ -170,17 +139,6 @@ namespace XCharts.Runtime
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得上一个同堆叠且显示的serie。
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public static Serie GetLastStackSerie(List<Serie> series, int index)
|
||||
{
|
||||
var serie = series[index];
|
||||
return GetLastStackSerie(series, serie);
|
||||
}
|
||||
|
||||
public static Serie GetSerieByVesselIndex(List<Serie> series, int vesselIndex)
|
||||
{
|
||||
foreach (var serie in series)
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
[CreateAssetMenu(menuName = "XCharts/Export Lang")]
|
||||
/// <summary>
|
||||
/// Language.
|
||||
/// |国际化语言表。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[CreateAssetMenu(menuName = "XCharts/Export Lang")]
|
||||
public class Lang : ScriptableObject
|
||||
{
|
||||
public string langName = "EN";
|
||||
@@ -58,6 +56,7 @@ namespace XCharts.Runtime
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class LangCandlestick
|
||||
{
|
||||
public List<string> dimensionNames = new List<string>() { "open", "close", "lowest", "highest" };
|
||||
|
||||
@@ -481,5 +481,11 @@ namespace XCharts.Runtime
|
||||
m_PainterTop.material = material;
|
||||
}
|
||||
}
|
||||
|
||||
public Color32 GetChartBackgroundColor()
|
||||
{
|
||||
var background = GetChartComponent<Background>();
|
||||
return theme.GetBackgroundColor(background);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ namespace XCharts.Runtime
|
||||
AddComponent(component);
|
||||
m_Components.Sort();
|
||||
CreateComponentHandler(component);
|
||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
#endif
|
||||
return component;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace XCharts.Runtime
|
||||
Vector3 pos, Color32 color, Color32 toColor, Color32 emptyColor, Color32 borderColor,
|
||||
float gap, float[] cornerRadius, Vector3 startPos)
|
||||
{
|
||||
var backgroundColor = theme.GetBackgroundColor(GetChartComponent<Background>());
|
||||
var backgroundColor = GetChartBackgroundColor();
|
||||
if (ChartHelper.IsClearColor(emptyColor))
|
||||
emptyColor = backgroundColor;
|
||||
var smoothness = settings.cicleSmoothness;
|
||||
|
||||
@@ -854,6 +854,9 @@ namespace XCharts.Runtime
|
||||
|
||||
private void ResetSeriesIndex()
|
||||
{
|
||||
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
|
||||
UnityEditor.EditorUtility.SetDirty(this);
|
||||
#endif
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
{
|
||||
m_Series[i].index = i;
|
||||
|
||||
@@ -597,7 +597,9 @@ namespace XCharts.Runtime
|
||||
|
||||
protected virtual void DrawBackground(VertexHelper vh)
|
||||
{
|
||||
if (HasChartComponent<Background>()) return;
|
||||
var background = GetChartComponent<Background>();
|
||||
if (background != null && background.show)
|
||||
return;
|
||||
Vector3 p1 = new Vector3(chartX, chartY + chartHeight);
|
||||
Vector3 p2 = new Vector3(chartX + chartWidth, chartY + chartHeight);
|
||||
Vector3 p3 = new Vector3(chartX + chartWidth, chartY);
|
||||
|
||||
@@ -413,7 +413,7 @@ namespace XCharts.Runtime
|
||||
label.UpdateIcon(iconStyle, axis.GetIcon(index));
|
||||
label.label.SetActive(labelShow);
|
||||
label.SetText(content);
|
||||
label.color = textStyle.color;
|
||||
label.color = textStyle.backgroundColor;
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace XCharts.Runtime
|
||||
label.SetAutoSize(true);
|
||||
label.label.SetActive(true);
|
||||
label.SetText(content);
|
||||
label.color = textStyle.color;
|
||||
label.color = textStyle.backgroundColor;
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ namespace XCharts.Runtime
|
||||
label.label = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme.tooltip, label.label);
|
||||
label.SetAutoSize(true);
|
||||
label.SetText("");
|
||||
label.color = textStyle.color;
|
||||
label.color = textStyle.backgroundColor;
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
m_EssentialResourcesImported = File.Exists("Assets/XCharts/Resources/XCSettings.asset");
|
||||
m_EssentialResourcesImported = Resources.Load<XCSettings>("XCSettings") != null;
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
{
|
||||
@@ -32,15 +32,19 @@ namespace XCharts.Runtime
|
||||
GUILayout.Space(5f);
|
||||
|
||||
GUI.enabled = !m_EssentialResourcesImported;
|
||||
GUI.enabled = true;
|
||||
if (GUILayout.Button("Import XCharts Essentials"))
|
||||
{
|
||||
string packageFullPath = GetPackageFullPath();
|
||||
var sourPath = Path.Combine(packageFullPath, "Resources");
|
||||
var destPath = Path.Combine(Application.dataPath, "XCharts/Resources");
|
||||
if (RuntimeUtil.CopyFolder(sourPath, destPath))
|
||||
string packageFullPath = XChartsMgr.GetPackageFullPath();
|
||||
if (packageFullPath != null)
|
||||
{
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
var sourPath = Path.Combine(packageFullPath, "Resources");
|
||||
var destPath = Path.Combine(Application.dataPath, "XCharts/Resources");
|
||||
if (RuntimeUtil.CopyFolder(sourPath, destPath))
|
||||
{
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
GUILayout.Space(5f);
|
||||
@@ -74,72 +78,26 @@ namespace XCharts.Runtime
|
||||
|
||||
AssetDatabase.importPackageCompleted -= ImportCallback;
|
||||
}
|
||||
|
||||
static string GetPackageFullPath()
|
||||
{
|
||||
// Check for potential UPM package
|
||||
string packagePath = Path.GetFullPath("Packages/com.monitor1394.xcharts");
|
||||
if (Directory.Exists(packagePath))
|
||||
{
|
||||
return packagePath;
|
||||
}
|
||||
|
||||
packagePath = Path.GetFullPath("Assets/..");
|
||||
if (Directory.Exists(packagePath))
|
||||
{
|
||||
// Search default location for development package
|
||||
if (Directory.Exists(packagePath + "/Assets/Packages/com.monitor1394.xcharts/Resources"))
|
||||
{
|
||||
return packagePath + "/Assets/Packages/com.monitor1394.xcharts";
|
||||
}
|
||||
|
||||
// Search for default location of normal XCharts AssetStore package
|
||||
if (Directory.Exists(packagePath + "/Assets/XCharts/Resources"))
|
||||
{
|
||||
return packagePath + "/Assets/XCharts";
|
||||
}
|
||||
|
||||
// Search for potential alternative locations in the user project
|
||||
string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories);
|
||||
string path = ValidateLocation(matchingPaths, packagePath);
|
||||
if (path != null) return packagePath + path;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static string ValidateLocation(string[] paths, string projectPath)
|
||||
{
|
||||
for (int i = 0; i < paths.Length; i++)
|
||||
{
|
||||
// Check if the Editor Resources folder exists.
|
||||
if (Directory.Exists(paths[i] + "/Package Resources"))
|
||||
{
|
||||
string folderPath = paths[i].Replace(projectPath, "");
|
||||
folderPath = folderPath.TrimStart('\\', '/');
|
||||
return folderPath;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class XChartsPackageResourceImporterWindow : UnityEditor.EditorWindow
|
||||
public class XCResourceImporterWindow : UnityEditor.EditorWindow
|
||||
{
|
||||
[SerializeField] XCResourcesImporter m_ResourceImporter;
|
||||
|
||||
static XChartsPackageResourceImporterWindow m_ImporterWindow;
|
||||
static XCResourceImporterWindow m_ImporterWindow;
|
||||
|
||||
public static void ShowPackageImporterWindow()
|
||||
{
|
||||
if (m_ImporterWindow == null)
|
||||
var packagePath = XChartsMgr.GetPackageFullPath();
|
||||
if (packagePath != null)
|
||||
{
|
||||
m_ImporterWindow = GetWindow<XChartsPackageResourceImporterWindow>();
|
||||
m_ImporterWindow.titleContent = new GUIContent("XCharts Importer");
|
||||
if (m_ImporterWindow == null)
|
||||
{
|
||||
m_ImporterWindow = GetWindow<XCResourceImporterWindow>();
|
||||
m_ImporterWindow.titleContent = new GUIContent("XCharts Importer");
|
||||
}
|
||||
m_ImporterWindow.Focus();
|
||||
}
|
||||
|
||||
m_ImporterWindow.Focus();
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
#if dUI_TextMeshPro
|
||||
using TMPro;
|
||||
#endif
|
||||
@@ -129,7 +130,11 @@ namespace XCharts.Runtime
|
||||
#if UNITY_EDITOR
|
||||
if (s_Instance == null)
|
||||
{
|
||||
XChartsPackageResourceImporterWindow.ShowPackageImporterWindow();
|
||||
var assetPath = GetSettingAssetPath();
|
||||
if (string.IsNullOrEmpty(assetPath))
|
||||
XCResourceImporterWindow.ShowPackageImporterWindow();
|
||||
else
|
||||
s_Instance = AssetDatabase.LoadAssetAtPath<XCSettings>(assetPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -150,6 +155,37 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ExistAssetFile()
|
||||
{
|
||||
return System.IO.File.Exists("Assets/XCharts/Resources/XCSettings.asset");
|
||||
}
|
||||
|
||||
public static string GetSettingAssetPath()
|
||||
{
|
||||
var path = "Assets/XCharts/Resources/XCSettings.asset";
|
||||
if (File.Exists(path)) return path;
|
||||
var dir = Application.dataPath;
|
||||
string[] matchingPaths = Directory.GetDirectories(dir);
|
||||
foreach (var match in matchingPaths)
|
||||
{
|
||||
if (match.Contains("XCharts"))
|
||||
{
|
||||
var jsonPath = string.Format("{0}/package.json", match);
|
||||
if (File.Exists(jsonPath))
|
||||
{
|
||||
var jsonText = File.ReadAllText(jsonPath);
|
||||
if (jsonText.Contains("\"displayName\": \"XCharts\""))
|
||||
{
|
||||
path = string.Format("{0}/Resources/XCSettings.asset", match);
|
||||
if (File.Exists(path))
|
||||
return path.Substring(path.IndexOf("/Assets/") + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool AddCustomTheme(Theme theme)
|
||||
{
|
||||
if (theme == null) return false;
|
||||
|
||||
@@ -23,9 +23,12 @@ namespace XCharts.Runtime
|
||||
XChartsMgr.themeNames.Clear();
|
||||
AddTheme(LoadTheme(ThemeType.Default));
|
||||
AddTheme(LoadTheme(ThemeType.Dark));
|
||||
foreach (var theme in XCSettings.customThemes)
|
||||
if (XCSettings.Instance != null)
|
||||
{
|
||||
AddTheme(theme);
|
||||
foreach (var theme in XCSettings.customThemes)
|
||||
{
|
||||
AddTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace XCharts.Runtime
|
||||
[ExecuteInEditMode]
|
||||
public static class XChartsMgr
|
||||
{
|
||||
public static readonly string version = "3.0.0-preview5";
|
||||
public static readonly int versionDate = 20220326;
|
||||
public static readonly string version = "3.0.0-preview7";
|
||||
public static readonly int versionDate = 20220407;
|
||||
public static string fullVersion { get { return version + "-" + versionDate; } }
|
||||
|
||||
internal static List<BaseChart> chartList = new List<BaseChart>();
|
||||
@@ -136,24 +136,20 @@ namespace XCharts.Runtime
|
||||
packagePath = Path.GetFullPath("Assets/..");
|
||||
if (Directory.Exists(packagePath))
|
||||
{
|
||||
// Search default location for development package
|
||||
if (File.Exists(packagePath + "/Assets/Packages/com.monitor1394.xcharts/package.json"))
|
||||
if (File.Exists(packagePath + "/Assets/Packages/XCharts/package.json"))
|
||||
{
|
||||
return packagePath + "/Assets/Packages/com.monitor1394.xcharts";
|
||||
return packagePath + "/Assets/Packages/XCharts";
|
||||
}
|
||||
|
||||
// Search for default location of normal XCharts AssetStore package
|
||||
if (File.Exists(packagePath + "/Assets/XCharts/package.json"))
|
||||
{
|
||||
return packagePath + "/Assets/XCharts";
|
||||
}
|
||||
|
||||
// Search for potential alternative locations in the user project
|
||||
string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories);
|
||||
string path = ValidateLocation(matchingPaths, packagePath);
|
||||
if (path != null) return Path.Combine(packagePath, path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -168,7 +164,6 @@ namespace XCharts.Runtime
|
||||
return folderPath;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace XCharts.Runtime
|
||||
public override Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)
|
||||
{
|
||||
var labelLine = SerieHelper.GetSerieLabelLine(serie, serieData);
|
||||
return SerieLabelHelper.GetRealLabelPosition(serieData, label, labelLine);
|
||||
return SerieLabelHelper.GetRealLabelPosition(serie, serieData, label, labelLine);
|
||||
}
|
||||
|
||||
public override void OnLegendButtonClick(int index, string legendName, bool show)
|
||||
@@ -151,11 +151,12 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var data = serie.data;
|
||||
serie.context.dataMax = serie.yMax;
|
||||
serie.context.startAngle = GetStartAngle(serie);
|
||||
var runtimePieDataTotal = serie.yTotal;
|
||||
|
||||
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
float startDegree = serie.context.startAngle;
|
||||
float totalDegree = 0;
|
||||
float startDegree = 0;
|
||||
float zeroReplaceValue = 0;
|
||||
int showdataCount = 0;
|
||||
foreach (var sd in serie.data)
|
||||
@@ -253,7 +254,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private double GetTotalAngle(Serie serie, double dataTotal, ref float totalAngle)
|
||||
{
|
||||
totalAngle = 360f;
|
||||
totalAngle = serie.context.startAngle + 360f;
|
||||
if (serie.minAngle > 0)
|
||||
{
|
||||
var rate = serie.minAngle / 360;
|
||||
@@ -435,6 +436,7 @@ namespace XCharts.Runtime
|
||||
Vector3 pos4, pos6;
|
||||
var horizontalLineCircleRadius = labelLine.lineWidth * 4f;
|
||||
var lineCircleDiff = horizontalLineCircleRadius - 0.3f;
|
||||
var startAngle = serie.context.startAngle;
|
||||
if (currAngle < 90)
|
||||
{
|
||||
var r4 = Mathf.Sqrt(radius1 * radius1 - Mathf.Pow(currCos * radius3, 2)) - currSin * radius3;
|
||||
@@ -467,7 +469,8 @@ namespace XCharts.Runtime
|
||||
pos6 = pos0 + Vector3.left * lineCircleDiff;
|
||||
pos4 = pos6 + Vector3.left * r4;
|
||||
}
|
||||
var pos5X = currAngle > 180 ? pos2.x - labelLine.lineLength2 : pos2.x + labelLine.lineLength2;
|
||||
var pos5X = (currAngle - startAngle) % 360 > 180
|
||||
? pos2.x - labelLine.lineLength2 : pos2.x + labelLine.lineLength2;
|
||||
var pos5 = new Vector3(pos5X, pos2.y);
|
||||
switch (labelLine.lineType)
|
||||
{
|
||||
@@ -526,5 +529,32 @@ namespace XCharts.Runtime
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private float GetStartAngle(Serie serie)
|
||||
{
|
||||
return serie.clockwise ? (serie.startAngle + 360) % 360 : 360 - serie.startAngle;
|
||||
}
|
||||
|
||||
private float GetToAngle(Serie serie, float angle)
|
||||
{
|
||||
var toAngle = angle + serie.startAngle;
|
||||
if (!serie.clockwise)
|
||||
{
|
||||
toAngle = 360 - angle - serie.startAngle;
|
||||
}
|
||||
if (!serie.animation.IsFinish())
|
||||
{
|
||||
var currAngle = serie.animation.GetCurrDetail();
|
||||
if (serie.clockwise)
|
||||
{
|
||||
toAngle = toAngle > currAngle ? currAngle : toAngle;
|
||||
}
|
||||
else
|
||||
{
|
||||
toAngle = toAngle < 360 - currAngle ? 360 - currAngle : toAngle;
|
||||
}
|
||||
}
|
||||
return toAngle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,15 +16,16 @@ namespace XCharts.Runtime
|
||||
serie.gap = 10;
|
||||
serie.radius = new float[] { 0.3f, 0.35f };
|
||||
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
serie.label.show = true;
|
||||
serie.label.position = LabelStyle.Position.Center;
|
||||
serie.label.formatter = "{d:f0}%";
|
||||
serie.label.textStyle.fontSize = 28;
|
||||
var label = serie.AddExtraComponent<LabelStyle>();
|
||||
label.show = true;
|
||||
label.position = LabelStyle.Position.Center;
|
||||
label.formatter = "{d:f0}%";
|
||||
label.textStyle.autoColor = true;
|
||||
label.textStyle.fontSize = 28;
|
||||
|
||||
serie.AddExtraComponent<TitleStyle>();
|
||||
serie.titleStyle.show = false;
|
||||
serie.titleStyle.textStyle.offset = new Vector2(0, 30);
|
||||
var titleStyle = serie.AddExtraComponent<TitleStyle>();
|
||||
titleStyle.show = false;
|
||||
titleStyle.textStyle.offset = new Vector2(0, 30);
|
||||
|
||||
var value = Random.Range(30, 90);
|
||||
var max = 100;
|
||||
|
||||
@@ -109,6 +109,33 @@ namespace XCharts.Runtime
|
||||
paramList.Add(param);
|
||||
}
|
||||
|
||||
public override Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)
|
||||
{
|
||||
var centerRadius = (serieData.context.outsideRadius + serieData.context.insideRadius) / 2;
|
||||
var startAngle = serieData.context.startAngle;
|
||||
var toAngle = serieData.context.toAngle;
|
||||
switch (label.position)
|
||||
{
|
||||
case LabelStyle.Position.Center:
|
||||
serieData.context.labelPosition = serie.context.center + label.offset;
|
||||
break;
|
||||
case LabelStyle.Position.Bottom:
|
||||
var px1 = Mathf.Sin(startAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
var py1 = Mathf.Cos(startAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
var xDiff = serie.clockwise ? -label.distance : label.distance;
|
||||
serieData.context.labelPosition = serie.context.center + new Vector3(px1 + xDiff, py1);
|
||||
break;
|
||||
case LabelStyle.Position.Top:
|
||||
startAngle += serie.clockwise ? -label.distance : label.distance;
|
||||
toAngle += serie.clockwise ? label.distance : -label.distance;
|
||||
var px2 = Mathf.Sin(toAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
var py2 = Mathf.Cos(toAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
serieData.context.labelPosition = serie.context.center + new Vector3(px2, py2);
|
||||
break;
|
||||
}
|
||||
return serieData.context.labelPosition;
|
||||
}
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
{
|
||||
if (!serie.show || serie.animation.HasFadeOut()) return;
|
||||
@@ -134,7 +161,6 @@ namespace XCharts.Runtime
|
||||
var itemToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, j, serieData.context.highlight);
|
||||
var outsideRadius = serie.context.outsideRadius - j * (ringWidth + serie.gap);
|
||||
var insideRadius = outsideRadius - ringWidth;
|
||||
var centerRadius = (outsideRadius + insideRadius) / 2;
|
||||
var borderWidth = itemStyle.borderWidth;
|
||||
var borderColor = itemStyle.borderColor;
|
||||
var roundCap = serie.roundCap && insideRadius > 0;
|
||||
@@ -153,7 +179,6 @@ namespace XCharts.Runtime
|
||||
Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness,
|
||||
roundCap, serie.clockwise);
|
||||
DrawCenter(vh, serie, serieData, insideRadius, j == data.Count - 1);
|
||||
UpateLabelPosition(serie, serieData, j, startDegree, toDegree, centerRadius);
|
||||
}
|
||||
if (!serie.animation.IsFinish())
|
||||
{
|
||||
@@ -233,34 +258,6 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void UpateLabelPosition(Serie serie, SerieData serieData, int index, float startAngle,
|
||||
float toAngle, float centerRadius)
|
||||
{
|
||||
var label = serie.label;
|
||||
if (label == null || !label.show) return;
|
||||
if (serieData.labelObject == null) return;
|
||||
switch (label.position)
|
||||
{
|
||||
case LabelStyle.Position.Center:
|
||||
serieData.context.labelPosition = serie.context.center + label.offset;
|
||||
break;
|
||||
case LabelStyle.Position.Bottom:
|
||||
var px1 = Mathf.Sin(startAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
var py1 = Mathf.Cos(startAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
var xDiff = serie.clockwise ? -label.distance : label.distance;
|
||||
serieData.context.labelPosition = serie.context.center + new Vector3(px1 + xDiff, py1);
|
||||
break;
|
||||
case LabelStyle.Position.Top:
|
||||
startAngle += serie.clockwise ? -label.distance : label.distance;
|
||||
toAngle += serie.clockwise ? label.distance : -label.distance;
|
||||
var px2 = Mathf.Sin(toAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
var py2 = Mathf.Cos(toAngle * Mathf.Deg2Rad) * centerRadius;
|
||||
serieData.context.labelPosition = serie.context.center + new Vector3(px2, py2);
|
||||
break;
|
||||
}
|
||||
serieData.labelObject.SetLabelPosition(serieData.context.labelPosition);
|
||||
}
|
||||
|
||||
private void DrawBackground(VertexHelper vh, Serie serie, SerieData serieData, int index, float insideRadius, float outsideRadius)
|
||||
{
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||
@@ -294,23 +291,6 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void DrawRoundCap(VertexHelper vh, Serie serie, Vector3 centerPos, Color color,
|
||||
float insideRadius, float outsideRadius, ref float drawStartDegree, ref float drawEndDegree)
|
||||
{
|
||||
if (serie.roundCap && insideRadius > 0 && drawStartDegree != drawEndDegree)
|
||||
{
|
||||
var width = (outsideRadius - insideRadius) / 2;
|
||||
var radius = insideRadius + width;
|
||||
|
||||
var diffDegree = Mathf.Asin(width / radius) * Mathf.Rad2Deg;
|
||||
drawStartDegree += serie.clockwise ? diffDegree : -diffDegree;
|
||||
drawEndDegree -= serie.clockwise ? diffDegree : -diffDegree;
|
||||
UGL.DrawRoundCap(vh, centerPos, width, radius, drawStartDegree, serie.clockwise, color, false);
|
||||
UGL.DrawRoundCap(vh, centerPos, width, radius, drawEndDegree, serie.clockwise, color, true);
|
||||
}
|
||||
}
|
||||
|
||||
private int GetRingIndex(Vector2 local)
|
||||
{
|
||||
var dist = Vector2.Distance(local, serie.context.center);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace XCharts.Runtime
|
||||
this.isIgnoreBreak = ignore;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class SerieContext
|
||||
{
|
||||
/// <summary>
|
||||
@@ -31,52 +31,53 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public List<int> pointerAxisDataIndexs = new List<int>();
|
||||
public bool isTriggerByAxis = false;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 中心点
|
||||
/// </summary>
|
||||
public Vector3 center { get; internal set; }
|
||||
public Vector3 center;
|
||||
/// <summary>
|
||||
/// 内半径
|
||||
/// </summary>
|
||||
public float insideRadius { get; set; }
|
||||
public float insideRadius;
|
||||
/// <summary>
|
||||
/// 外半径
|
||||
/// </summary>
|
||||
public float outsideRadius { get; set; }
|
||||
public float outsideRadius;
|
||||
public float startAngle;
|
||||
/// <summary>
|
||||
/// 最大值
|
||||
/// </summary>
|
||||
public double dataMax { get; internal set; }
|
||||
public double dataMax;
|
||||
/// <summary>
|
||||
/// 最小值
|
||||
/// </summary>
|
||||
public double dataMin { get; internal set; }
|
||||
public double checkValue { get; set; }
|
||||
public double dataMin;
|
||||
public double checkValue;
|
||||
/// <summary>
|
||||
/// 左下角坐标X
|
||||
/// </summary>
|
||||
public float x { get; internal set; }
|
||||
public float x;
|
||||
/// <summary>
|
||||
/// 左下角坐标Y
|
||||
/// </summary>
|
||||
public float y { get; internal set; }
|
||||
public float y;
|
||||
/// <summary>
|
||||
/// 宽
|
||||
/// </summary>
|
||||
public float width { get; internal set; }
|
||||
public float width;
|
||||
/// <summary>
|
||||
/// 高
|
||||
/// </summary>
|
||||
public float height { get; internal set; }
|
||||
public float height;
|
||||
/// <summary>
|
||||
/// 矩形区域
|
||||
/// </summary>
|
||||
public Rect rect { get; internal set; }
|
||||
public Rect rect;
|
||||
/// <summary>
|
||||
/// 绘制顶点数
|
||||
/// </summary>
|
||||
public int vertCount { get; internal set; }
|
||||
public int vertCount;
|
||||
/// <summary>
|
||||
/// 数据对应的位置坐标。
|
||||
/// </summary>
|
||||
|
||||
@@ -7,57 +7,56 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public class SerieDataContext
|
||||
{
|
||||
public Vector3 labelPosition { get; set; }
|
||||
public Vector3 labelPosition;
|
||||
/// <summary>
|
||||
/// 开始角度
|
||||
/// </summary>
|
||||
public float startAngle { get; internal set; }
|
||||
public float startAngle;
|
||||
/// <summary>
|
||||
/// 结束角度
|
||||
/// </summary>
|
||||
public float toAngle { get; internal set; }
|
||||
public float toAngle;
|
||||
/// <summary>
|
||||
/// 一半时的角度
|
||||
/// </summary>
|
||||
public float halfAngle { get; internal set; }
|
||||
public float halfAngle;
|
||||
/// <summary>
|
||||
/// 当前角度
|
||||
/// </summary>
|
||||
public float currentAngle { get; internal set; }
|
||||
public float currentAngle;
|
||||
/// <summary>
|
||||
/// 饼图数据项的内半径
|
||||
/// </summary>
|
||||
public float insideRadius { get; internal set; }
|
||||
public float insideRadius;
|
||||
/// <summary>
|
||||
/// 饼图数据项的偏移半径
|
||||
/// </summary>
|
||||
public float offsetRadius { get; internal set; }
|
||||
public float outsideRadius { get; set; }
|
||||
public Vector3 position { get; set; }
|
||||
public float offsetRadius;
|
||||
public float outsideRadius;
|
||||
public Vector3 position;
|
||||
public List<Vector3> dataPoints = new List<Vector3>();
|
||||
public List<SerieData> children = new List<SerieData>();
|
||||
|
||||
/// <summary>
|
||||
/// 绘制区域。
|
||||
/// </summary>
|
||||
public Rect rect { get; set; }
|
||||
public Rect subRect { get; set; }
|
||||
public int level { get; set; }
|
||||
public SerieData parent { get; set; }
|
||||
public Color32 color { get; set; }
|
||||
public double area { get; set; }
|
||||
public float angle { get; set; }
|
||||
public Vector3 offsetCenter { get; set; }
|
||||
public float stackHeight { get; set; }
|
||||
public bool isClip { get; set; }
|
||||
public Rect rect;
|
||||
public Rect subRect;
|
||||
public int level;
|
||||
public SerieData parent;
|
||||
public Color32 color;
|
||||
public double area;
|
||||
public float angle;
|
||||
public Vector3 offsetCenter;
|
||||
public float stackHeight;
|
||||
public bool isClip;
|
||||
|
||||
public bool canShowLabel = true;
|
||||
public Image symbol { get; set; }
|
||||
public Image symbol;
|
||||
/// <summary>
|
||||
/// Whether the data item is highlighted.
|
||||
/// |该数据项是否被高亮,一般由鼠标悬停或图例悬停触发高亮。
|
||||
/// </summary>
|
||||
public bool highlight { get; set; }
|
||||
|
||||
public bool highlight;
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
if (serie.dataDirty)
|
||||
{
|
||||
SeriesHelper.UpdateSerieNameList(chart, ref chart.m_LegendRealShowName);
|
||||
serie.OnDataUpdate();
|
||||
serie.dataDirty = false;
|
||||
}
|
||||
@@ -233,8 +234,10 @@ namespace XCharts.Runtime
|
||||
&& (iconStyle == null || !iconStyle.show))
|
||||
return false;
|
||||
|
||||
var dataAutoColor = (Color)chart.theme.GetColor(serieData.index);
|
||||
|
||||
var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index);
|
||||
var color = chart.theme.common.textColor;
|
||||
var color = serieLabel.textStyle.autoColor ? dataAutoColor : chart.theme.common.textColor;
|
||||
var iconWidth = iconStyle != null ? iconStyle.width : 20;
|
||||
var iconHeight = iconStyle != null ? iconStyle.height : 20;
|
||||
var labelObj = SerieLabelPool.Get(textName, serieLabelRoot.transform, serieLabel, color,
|
||||
@@ -246,7 +249,7 @@ namespace XCharts.Runtime
|
||||
item.SetIcon(iconImage);
|
||||
item.SetIconActive(iconStyle != null && iconStyle.show);
|
||||
if (serieLabel.textStyle.autoBackgroundColor)
|
||||
item.color = chart.theme.GetColor(serieData.index);
|
||||
item.color = dataAutoColor;
|
||||
else
|
||||
item.color = serieLabel.textStyle.backgroundColor;
|
||||
serieData.labelObject = item;
|
||||
@@ -317,7 +320,6 @@ namespace XCharts.Runtime
|
||||
var iconStyle = SerieHelper.GetIconStyle(serie, serieData);
|
||||
var isIgnore = serie.IsIgnoreIndex(serieData.index, defaultDimension);
|
||||
var currLabel = isHighlight && emphasisLabel != null ? emphasisLabel : serieLabel;
|
||||
|
||||
serieData.labelObject.UpdateIcon(iconStyle);
|
||||
if (serie.show
|
||||
&& currLabel != null
|
||||
@@ -339,6 +341,8 @@ namespace XCharts.Runtime
|
||||
textColor = currLabel.textStyle.color;
|
||||
else if (isInsidePosition)
|
||||
textColor = Color.white;
|
||||
if (currLabel.textStyle.autoColor && serie.useDataNameForColor)
|
||||
textColor = chart.theme.GetColor(serieData.index);
|
||||
//text rotate
|
||||
var rotate = currLabel.textStyle.rotate;
|
||||
if (currLabel.textStyle.rotate > 0 && isInsidePosition)
|
||||
|
||||
@@ -9,12 +9,11 @@ using TMPro;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
/// <summary>
|
||||
/// Theme.
|
||||
/// |主题相关配置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Theme : ScriptableObject
|
||||
{
|
||||
[SerializeField] private ThemeType m_ThemeType = ThemeType.Default;
|
||||
@@ -354,7 +353,6 @@ namespace XCharts.Runtime
|
||||
subTitle.tmpFont = tmpFont;
|
||||
legend.tmpFont = tmpFont;
|
||||
axis.tmpFont = tmpFont;
|
||||
gauge.tmpFont = tmpFont;
|
||||
tooltip.tmpFont = tmpFont;
|
||||
dataZoom.tmpFont = tmpFont;
|
||||
visualMap.tmpFont = tmpFont;
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace XCharts.Runtime
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Theme m_SharedTheme;
|
||||
[SerializeField] private bool m_EnableCustomTheme;
|
||||
[SerializeField] private bool m_TransparentBackground = false;
|
||||
[SerializeField] private bool m_EnableCustomTheme = false;
|
||||
[SerializeField] private Font m_CustomFont;
|
||||
[SerializeField] private Color32 m_CustomBackgroundColor;
|
||||
#if UNITY_2020_2
|
||||
@@ -83,8 +84,27 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public Color32 backgroundColor
|
||||
{
|
||||
get { return m_EnableCustomTheme ? m_CustomBackgroundColor : sharedTheme.backgroundColor; }
|
||||
get
|
||||
{
|
||||
if (m_TransparentBackground) return ColorUtil.clearColor32;
|
||||
else return m_EnableCustomTheme ? m_CustomBackgroundColor : sharedTheme.backgroundColor;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether the background color is transparent. When true, the background color is not drawn.
|
||||
/// |是否透明背景颜色。当设置为true时,不绘制背景颜色。
|
||||
/// </summary>
|
||||
public bool transparentBackground
|
||||
{
|
||||
get { return m_TransparentBackground; }
|
||||
set { m_TransparentBackground = value; SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to customize theme colors. When set to true,
|
||||
/// you can use 'sync color to custom' to synchronize the theme color to the custom color. It can also be set manually.
|
||||
/// |是否自定义主题颜色。当设置为true时,可以用‘sync color to custom’同步主题的颜色到自定义颜色。也可以手动设置。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public bool enableCustomTheme
|
||||
{
|
||||
get { return m_EnableCustomTheme; }
|
||||
@@ -138,7 +158,7 @@ namespace XCharts.Runtime
|
||||
public Color32 GetBackgroundColor(Background background)
|
||||
{
|
||||
if (background != null && background.show && background.hideThemeBackgroundColor)
|
||||
return ChartConst.clearColor32;
|
||||
return background.imageColor;
|
||||
else
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace XUGL
|
||||
public class SVGPath
|
||||
{
|
||||
private static Regex s_PathRegex = new Regex(@"(([a-z]|[A-Z])(\d|\.|,|-)*)");
|
||||
// private static Regex s_PathValueRegex = new Regex(@"(^[a-z]|[A-Z])\s*(-?\d+\.*\d*)*[\s|,|-]*(\d+\.*\d*)*");
|
||||
private static Regex s_PathValueRegex = new Regex(@"(^[a-z]|[A-Z])\s*(-?\d+\.*\d*)*[\s|,|-]*(\d+\.*\d*)*");
|
||||
private static Regex s_PathValueRegex2 = new Regex(@"(-?\d+\.?\d*)");
|
||||
public bool mirrorY = true;
|
||||
|
||||
12
package.json
12
package.json
@@ -1,18 +1,16 @@
|
||||
{
|
||||
"name": "com.monitor1394.xcharts",
|
||||
"displayName": "XCharts",
|
||||
"version": "3.0.0-preview5",
|
||||
"date": "20220326",
|
||||
"checkdate": "20220326",
|
||||
"version": "3.0.0-preview7",
|
||||
"date": "20220407",
|
||||
"checkdate": "20220407",
|
||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||
"unity": "2018.3",
|
||||
"description": "A charting and data visualization library for Unity.",
|
||||
"keywords": [
|
||||
"unity",
|
||||
"chart",
|
||||
"xcharts",
|
||||
"graphic",
|
||||
"visualization",
|
||||
"charts",
|
||||
"graph",
|
||||
"data-visualization"
|
||||
],
|
||||
"category": "chart",
|
||||
|
||||
Reference in New Issue
Block a user