mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 11:40:13 +00:00
Compare commits
93 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
113c3887ae | ||
|
|
9f5040435f | ||
|
|
f21e9c6a32 | ||
|
|
a071956675 | ||
|
|
eab4f9530b | ||
|
|
ce8b03b692 | ||
|
|
2505a48ac2 | ||
|
|
74e75e93af | ||
|
|
4f8390b515 | ||
|
|
d91ebeee3a | ||
|
|
b9c5623687 | ||
|
|
34b4096482 | ||
|
|
bc75865a5e | ||
|
|
c987cb1ef7 | ||
|
|
d93f7830de | ||
|
|
61a2da10ba | ||
|
|
9e39150009 | ||
|
|
653b81cc48 | ||
|
|
e68e41a939 | ||
|
|
d0448a5b11 | ||
|
|
daec83c4a5 | ||
|
|
6aa11249c5 | ||
|
|
9a56985b3a | ||
|
|
fff04347fa | ||
|
|
5a5ad1e108 | ||
|
|
3c233d1cb1 | ||
|
|
c44583772c | ||
|
|
29e9593179 | ||
|
|
318bdcb1f2 | ||
|
|
c3489fbc1e | ||
|
|
91db00a173 | ||
|
|
a3533dbc02 | ||
|
|
f1c504e81a | ||
|
|
178215d980 | ||
|
|
cbd527316e | ||
|
|
3580df9117 | ||
|
|
11bdbba286 | ||
|
|
4ed22190d6 | ||
|
|
06ef86a9d6 | ||
|
|
3d73578063 | ||
|
|
07caa54631 | ||
|
|
023eeb9ea8 | ||
|
|
2431a001b1 | ||
|
|
e83eeabf9c | ||
|
|
9c5b83dc22 | ||
|
|
9d2b14afef | ||
|
|
63173cdce6 | ||
|
|
922a944881 | ||
|
|
53c7ddf9d4 | ||
|
|
a50bda5344 | ||
|
|
e8c8ab87aa | ||
|
|
1c6904f074 | ||
|
|
225fc69e70 | ||
|
|
546077459f | ||
|
|
bdc6c3b289 | ||
|
|
bbf1dc862c | ||
|
|
c841ac4a93 | ||
|
|
bece2eb564 | ||
|
|
735e36d6e5 | ||
|
|
0a19b2a6cc | ||
|
|
7ea260b986 | ||
|
|
cdc182191b | ||
|
|
45be0748aa | ||
|
|
1f970cbb36 | ||
|
|
4aee1b0a92 | ||
|
|
079d1030ae | ||
|
|
ddf44a8c1d | ||
|
|
f94f678661 | ||
|
|
9816c34701 | ||
|
|
b959b15c71 | ||
|
|
c9ac0daed9 | ||
|
|
65684f2952 | ||
|
|
509bd97741 | ||
|
|
83db4dd951 | ||
|
|
a730404935 | ||
|
|
f51e5f1859 | ||
|
|
e8204fc41e | ||
|
|
304726debf | ||
|
|
d8ecb94dd9 | ||
|
|
573f9efcaf | ||
|
|
985f70c3c9 | ||
|
|
68d5bc36d6 | ||
|
|
6b931497ab | ||
|
|
4bbedc8ef6 | ||
|
|
7f2de53af9 | ||
|
|
48a4fb470a | ||
|
|
c67d3a3a80 | ||
|
|
6a5026e907 | ||
|
|
38716facba | ||
|
|
86f0ae5739 | ||
|
|
fea5ab34c0 | ||
|
|
789ab008f6 | ||
|
|
7f525ebaf0 |
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,10 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.10.2](#v3102)
|
||||
[v3.10.1](#v3101)
|
||||
[v3.10.0](#v3100)
|
||||
[v3.9.0](#v390)
|
||||
[v3.8.1](#v381)
|
||||
[v3.8.0](#v380)
|
||||
[v3.7.0](#v370)
|
||||
@@ -64,6 +68,98 @@
|
||||
|
||||
## master
|
||||
|
||||
## v3.10.2
|
||||
|
||||
* (2024.03.11) Release `v3.10.2`
|
||||
* (2024.03.11) Fix to `Legend`'s `formatter` showing possible mismatches when setting {d} (#304)
|
||||
* (2024.03.11) Fix to `Tooltip` still showing after moving out of coordinate system
|
||||
* (2024.03.08) Fixed an issue where `Tooltip`'s title might not appear after upgrading from an older version
|
||||
|
||||
## v3.10.1
|
||||
|
||||
* (2024.02.21) Release `v3.10.1`
|
||||
* (2024.02.19) Fix to `Tooltip` dot markers not adapting to color
|
||||
|
||||
## v3.10.0
|
||||
|
||||
Highlights:
|
||||
|
||||
* Added bi-category axis support
|
||||
* Added more segmentation shortcut menu to create charts, which can create dozens of charts with one click
|
||||
* Added chart border Settings to support rounded corner charts
|
||||
* Fixed several issues
|
||||
|
||||
Extended features:
|
||||
|
||||
* Added `SankeyChart` Sankey chart
|
||||
* Added `border` Settings for `UITable`
|
||||
|
||||
Log details:
|
||||
|
||||
* (2024.02.01) Release `v3.10.0`
|
||||
* (2024.01.31) Fix to Tooltip not displaying after itemFormatter is set to -
|
||||
* (2024.01.27) Fix to TextLimit not working after TextMeshPro is enabled (#301)
|
||||
* (2024.01.24) Added `Bar` to support both X and Y axes as` Category `axes
|
||||
* (2024.01.23) Added `{y}` wildcard to get the class name of the Y-axis
|
||||
* (2024.01.23) Added `Line` to support both X and Y axes as` Category `axes
|
||||
* (2024.01.18) Fixed dynamic modification of `Animation`s `type` code
|
||||
* (2024.01.13) Added more quick Chart creation menus for Chart
|
||||
* (2024.01.09) added `borderStyle` to `Background` to give the chart rounded corners by default
|
||||
* (2024.01.07) Fix to invalid first ContentLabelStyle setting color for Tooltop
|
||||
* (2024.01.01) Added `BorderStyle` border style
|
||||
* (2023.12.26) Added support for Heatmap's maxCache parameter
|
||||
* (2023.12.25) Optimizes the number of vertices drawn when `Line`` opens clip
|
||||
* (2023.12.22) Fixed an issue where some border data of `Scatter` map was not displayed
|
||||
* (2023.12.21) Fix to `TriggerTooltip()` interface may not fire when 0 or maximum index is specified
|
||||
* (2023.12.19) Fixed an issue where `Legend`'s `LabelStyle` does not take effect after setting its formatter
|
||||
* (2023.12.12) Added TextLimit for Legend to limit the length of the text displayed in the legend
|
||||
* (2023.12.11) Fix to coordinate drawing failure when `Serie` was added with `double-maxvalue`
|
||||
* (2023.12.10) Add `Serie` to `minShowLabel` to hide `labels` that are less than the specified value
|
||||
* (2023.12.09) Add depth to `LevelStyle` to specify the level to which it belongs
|
||||
* (2023.12.09) Added `LevelStyle` `LineStyle` to set line styles
|
||||
* (2023.12.09) Adding `Serie` to `Link` can be used to add node-edge relationships to Sankey diagrams
|
||||
* (2023.12.05) added `ResetChartStatus()` to actively reset chart status
|
||||
|
||||
## v3.9.0
|
||||
|
||||
Highlights:
|
||||
|
||||
* Added `Animation` in `Axis` to improve the animation effect of data changes
|
||||
* Added `minorTick` for `Log` type of `Axis`
|
||||
* Added MarkLine's `onTop` setting to displayed at the top level
|
||||
* Perfect code comments and documentation
|
||||
* Fixed several issues
|
||||
|
||||
Extended features:
|
||||
|
||||
* `UITable` adds the carousel function
|
||||
* `UITable` adds data api and callback functions
|
||||
* `Pie3DChart` optimizes rendering performance
|
||||
|
||||
Log details:
|
||||
|
||||
* (2023.12.01) Release `v3.9.0`
|
||||
* (2023.12.01) Fixed inaccurate display of Tooltip's `titleFormatter` set to `{b}`
|
||||
* (2023.11.30) Added support for `SerieData` to add `Label` separately
|
||||
* (2023.11.28) Fix to `Tooltip` incorrectly indicating the number line
|
||||
* (2023.11.24) fixed inaccurate return values in Chart's `UpdateData()` interface
|
||||
* (2023.11.24) Fix to `Axis` not working smoothly when updating data
|
||||
* (2023.11.23) Added Animation support for Axis
|
||||
* (2023.11.16) Cancel `Legend`'s `formatter` and replace it with `LabelStyle`
|
||||
* (2023.11.14) Improved annotation and documentation for LabelStyle's formatter (#291)
|
||||
* (2023.11.11) Fix to comments Documentation for some comments in `Documentation` (#290)
|
||||
* (2023.11.11) fixed an issue where Legend's formatter didn't refresh automatically when data was changed
|
||||
* (2023.11.05) Fix to SerieEventData's value always being 0 (#287)
|
||||
* (2023.11.03) Fix to abnormal mouse movement when setting `Bar` gradient (#285)
|
||||
* (2023.11.02) Optimizes ignoring of formatter when SerieData is set to ignore
|
||||
* (2023.11.01) Added whether MarkLine's `onTop` setting is displayed at the top level
|
||||
* (2023.10.21) Fix to `Label` location exception when `Pie` has 0 data
|
||||
* (2023.10.21) Added subscale support for `Axis`
|
||||
* (2023.10.19) Fixed abnormal lead line when `Pie` set rose chart
|
||||
* (2023.10.15) Fixed Animation exception when `Line` was set to `AlongPath` (#281)
|
||||
* (2023.10.12) Fixed invalid value axis when `MarkLine` specified `yValue`
|
||||
* (2023.10.11) Fixed invalid setting of `Serie` `showDataDimension`
|
||||
|
||||
## v3.8.1
|
||||
|
||||
* (2023.10.02) Release `v3.8.1` version
|
||||
@@ -104,7 +200,7 @@ Log details:
|
||||
* (2023.08.22) Fixed `Bar` display hidden drawing performance exception
|
||||
* (2023.08.22) Improved Zebra histogram rendering performance (#276)
|
||||
* (2023.08.16) Added Daemon daemon to resolve an error after TMP is enabled locally
|
||||
* (2023.08.15) Fixed `Data` displaying axes incorrectly when data is between -1 and 1 (#273) (by __Ambitroc__)
|
||||
* (2023.08.15) Fixed `Data` displaying axes incorrectly when data is between -1 and 1 (#273) (by **Ambitroc**)
|
||||
* (2023.08.14) Fixed `XCharts` updating error after` TextMeshPro `and` NewInputSystem `are enabled locally (#272)
|
||||
* (2023.08.12) Fixed `Chart` error when deleted at runtime (#269)
|
||||
* (2023.08.11) Fixed an issue where data could not be added when DataZoom was enabled
|
||||
@@ -145,7 +241,7 @@ Log details:
|
||||
|
||||
* (2022.06.08) Release v3.7.0
|
||||
* (2023.06.04) Added `HelpDoc` help document skip
|
||||
* (2023.05.30) Fixed Serie name with `_` line causing `Legend` to not fire (#252) (by __svr2kos2__)
|
||||
* (2023.05.30) Fixed Serie name with `_` line causing `Legend` to not fire (#252) (by **svr2kos2**)
|
||||
* (2023.05.10) Added `MinMaxAuto` range type for `Axis`
|
||||
* (2023.05.10) Added support for `Clip` for `Line`
|
||||
* (2023.05.04) Fixed `Axis` setting` CeilRate `not taking effect in range -1 to 1
|
||||
@@ -164,9 +260,9 @@ Log details:
|
||||
|
||||
* (2023.04.01) Release `v3.6.0` version
|
||||
* (2023.03.14) Fix for Tooltip's `titleFormater` setting `{b}` may not take effect
|
||||
* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by __Ambitroc__)
|
||||
* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by **Ambitroc**)
|
||||
* (2023.03.12) Added `LabelStyle` `autoRotate` to set automatic rotation of angled vertical text
|
||||
* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by __Ambitroc__)
|
||||
* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by **Ambitroc**)
|
||||
* (2023.03.09) Adds callbacks to Chart's `onSerieClick`, `onSerieDown`, `onSerieEnter` and `onSerieExit`
|
||||
* (2023.03.09) Fixed click-check offset for `Pie` not taking effect
|
||||
* (2023.03.04) Added Positions for Legend to customize legend positions
|
||||
@@ -180,7 +276,7 @@ Log details:
|
||||
* (2023.02.02) Fixed bug where datazoom xaxis label could be displayed off-chart when datazoom is turned on
|
||||
* (2023.02.02) Optimizes the `ignore` setting of `SerieData` to ignore data
|
||||
* (2023.02.01) Fix `XChartsMgr.ContainsChart()` interface exception
|
||||
* (2023.01.31) Added support for `InputSystem` (#242) (by __Bian-Sh__)
|
||||
* (2023.01.31) Added support for `InputSystem` (#242) (by **Bian-Sh**)
|
||||
* (2023.01.11) Fixed chart not refreshing after removing Component from Inspector (#241)
|
||||
* (2023.01.06) Fixed bug with `Pie` displaying abnormal Label when the last few values are 0 (#240)
|
||||
* (2023.01.03) deletes serie `MarkColor` and adds ItemStyle `MarkColor`
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,150 +1,168 @@
|
||||
# XCharts FAQ
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)<br/>
|
||||
[XCharts API](XChartsAPI-EN.md)<br/>
|
||||
[XCharts Configuration](XChartsConfiguration-EN.md)
|
||||
[FAQ 1: How to adjust the margin between the axis and the background?](#how-to-adjust-the-margin-between-the-axis-and-the-background)
|
||||
[FAQ 2: How to play agian the fadeIn animation?](#how-to-play-agian-the-fadein-animation)
|
||||
[FAQ 3: How to customize the color of data item in line chart and pie chart?](#how-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
|
||||
[FAQ 4: How to formatter the text of axis label, such as add a units text?](#how-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
|
||||
[FAQ 5: How to stack the bar of bar chart](#how-to-stack-the-bar-of-bar-chart)
|
||||
[FAQ 6: How to make the bar serie in the same bar but not stack?](#how-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
|
||||
[FAQ 7: How to adjust the bar width and gap of barchart?](#how-to-adjust-the-bar-width-and-gap-of-barchart)
|
||||
[FAQ 8: How to adjust the color of bar?](#how-to-adjust-the-color-of-bar)
|
||||
[FAQ 9: Can I adjust the anchor of chart?](#can-i-adjust-the-anchor-of-chart)
|
||||
[FAQ 10: Can display more than 1000 data?](#can-display-more-than-1000-data)
|
||||
[FAQ 11: Can line chart drawing be dash, dot and dash-dot?](#can-line-chart-drawing-be-dash-dot-and-dash-dot)
|
||||
[FAQ 12: How to limit the value range of the Y-axis?](#how-to-limit-the-value-range-of-the-y-axis)
|
||||
[FAQ 13: How to customize the tick value range of value axis?](#how-to-customize-the-tick-value-range-of-value-axis)
|
||||
[FAQ 14: How to display text at the top of data items?](#how-to-display-text-at-the-top-of-data-items)
|
||||
[FAQ 15: How do I customize icons for data items?](#how-do-i-customize-icons-for-data-items)
|
||||
[FAQ 16: How to anti-aliasing and make the chart smoother?](#how-to-anti-aliasing-and-make-the-chart-smoother)
|
||||
[FAQ 17: Why does mouse over chart Tooltip not show?](#why-does-mouse-over-chart-tooltip-not-show)
|
||||
[FAQ 18: How not to display the bar line of Tooltip?](#how-not-to-display-the-bar-line-of-tooltip)
|
||||
[FAQ 19: How do I customize the display of Tooltip?](#how-do-i-customize-the-display-of-tooltip)
|
||||
[FAQ 20: How do I get the Y-axis to display multiple decimal places?](#how-do-i-get-the-y-axis-to-display-multiple-decimal-places)
|
||||
[FAQ 21: How do I dynamically update data with code?](#how-do-i-dynamically-update-data-with-code)
|
||||
[FAQ 22: How to display legend? Why are legends sometimes not displayed?](#how-to-display-legend-why-are-legends-sometimes-not-displayed)
|
||||
[FAQ 23: How to make chart as prefab?](#how-to-make-chart-as-prefab)
|
||||
[FAQ 24: How do I draw custom graphic in chart,such as line or dot?](#how-do-i-draw-custom-content-in-chart-such-as-line-or-dot)
|
||||
[FAQ 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#how-to-achieve-similar-data-movement-effect-of-electro-cardiogram)
|
||||
[FAQ 26: How do I use the background component? What are the conditions?](#how-do-i-use-the-background-component-what-are-the-conditions)
|
||||
[FAQ 27: Mesh can not have more than 65000 vertices?](#mesh-cannot-have-more-than-65000-vertices)
|
||||
[FAQ 28: Why are the parameters set in Serie reset after they run?](#why-are-the-parameters-set-in-serie-reset-after-they-run)
|
||||
[FAQ 29: How to change the color of serie symbol?](#how-to-change-the-color-of-serie-symbol)
|
||||
[FAQ 30: How to deal with TMP errors when importing or updating XCharts?](#what-if-tmp-errors-occur-when-importing-or-updating-xcharts)
|
||||
[FAQ 31: Support empty data? How to achieve the effect of line chart disconnection?](#support-empty-data-how-to-achieve-the-effect-of-line-chart-disconnection)
|
||||
[FAQ 32: 2.x What are the common problems when upgrading version 3.x?](#what-are-the-common-problems-when-upgrading-xcharts2-to-xcharts3)
|
||||
|
||||
[QA 1: How to adjust the margin between the axis and the background?](#How-to-adjust-the-margin-between-the-axis-and-the=-background)
|
||||
[QA 2: How to play agian the fadeIn animation?](#How-to-play-agian-the-fadeIn-animation)
|
||||
[QA 3: How to customize the color of data item in line chart and pie chart?](#How-to-customize-the-color-of-data-item-in-line-chart-and-pie-chart)
|
||||
[QA 4: How to formatter the text of axis label, such as add a units text?](#How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text)
|
||||
[QA 5: How to stack the bar of bar chart](#How-to-stack-the-bar-of-bar-chart)
|
||||
[QA 6: How to make the bar serie in the same bar but not stack?](#How-to-make-the-bar-serie-in-the-same-bar-but-not-stack)
|
||||
[QA 7: How to adjust the bar width and gap of barchart?](#How-to-adjust-the-bar-width-and-gap-of-barchart)
|
||||
[QA 8: How to adjust the color of bar?](#How-to-adjust-the-color-of-bar)
|
||||
[QA 9: Can I adjust the anchor of chart?](#Can-I-adjust-the-anchor-of-chart)
|
||||
[QA 10: Can display more than 1000 data?](#Can-display-more-than-1000-data)
|
||||
[QA 11: Can line chart drawing be dash, dot and dash-dot?](#Can-line-chart-drawing-be-dash-dot-and-dash-dot)
|
||||
[QA 12: How to limit the value range of the Y-axis?](#How-to-limit-the-value-range-of-the-Y-axis)
|
||||
[QA 13: How to customize the tick value range of value axis?](#How-to-customize-the-tick-value-range-of-value-axis)
|
||||
[QA 14: How to display text at the top of data items?](#How-to-display-text-at-the-top-of-data-items)
|
||||
[QA 15: How do I customize icons for data items?](#How-do-I-customize-icons-for-data-items)
|
||||
[QA 16: How to anti-aliasing and make the chart smoother?](#How-to-anti-aliasing-and-make-the-chart-smoother)
|
||||
[QA 17: Why does mouse over chart Tooltip not show?](#Why-does-mouse-over-chart-Tooltip-not-show)
|
||||
[QA 18: How not to display the bar line of Tooltip?](#How-not-to-display-the-bar-line-of-Tooltip)
|
||||
[QA 19: How do I customize the display of Tooltip?](#How-do-I-customize-the-display-of-Tooltip)
|
||||
[QA 20: How do I get the Y-axis to display multiple decimal places?](#How-do-I-get-the-Y-axis-to-display-multiple-decimal-places)
|
||||
[QA 21: How do I dynamically update data with code?](#How-do-I-dynamically-update-data-with-code)
|
||||
[QA 22: How to display legend? Why are legends sometimes not displayed?](#How-to-display-legend?Why-are-legends-sometimes-not-displayed)
|
||||
[QA 23: How to make chart as prefab?](#How-to-make-chart-as-prefab)
|
||||
[QA 24: How do I draw custom graphic in chart,such as line or dot?](#How-do-I-draw-custom-content-in-chart-such-as-line-or-dot)
|
||||
[QA 25: How to achieve similar data movement effect of ELECTRO cardiogram?](#How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram)
|
||||
[QA 26: How do I use the background component? What are the conditions?](#How-do-I-use-the-background-component-What-are-the-conditions)
|
||||
[QA 27: Mesh can not have more than 65000 vertices?](#Mesh-cannot-have-more-than-65000-vertices)
|
||||
[QA 28: Why are the parameters set in Serie reset after they run?](#Why-are-the-parameters-set-in-Serie-reset-after-they-run)
|
||||
## how-to-adjust-the-margin-between-the-axis-and-the-background
|
||||
|
||||
## How-to-adjust-the-margin-between-the-axis-and-the=-background
|
||||
`Grid` conponent,which can adjust the left, right, up, down margins of chart.
|
||||
|
||||
A: `Grid` conponent,which can adjust the left, right, up, down margins of chart.
|
||||
## how-to-play-agian-the-fadein-animation
|
||||
|
||||
## How-to-play-agian-the-fadeIn-animation
|
||||
call the `chart.AnimationReset()` API.
|
||||
|
||||
A: call the `chart.AnimationReset()` API.
|
||||
## how-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
|
||||
|
||||
## How-to-customize-the-color-of-data-item-in-line chart-and-pie-chart
|
||||
`Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
|
||||
|
||||
A: `Theme`->`colorPalette`, or the sub component `LineStyle` and `ItemStyle` of `Serie`.
|
||||
## how-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
|
||||
|
||||
## How-to-formatter-the-text-of-axis-label-such-as-add-a-units-text
|
||||
Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
|
||||
|
||||
A: Adjust `formatter` and `numericFormatter` parameter of `Legend`, `AxisLabel`, `Tooltop`, `SerieLabel`.
|
||||
## how-to-stack-the-bar-of-bar-chart
|
||||
|
||||
## How-to-stack-the-bar-of-bar-chart
|
||||
Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
|
||||
|
||||
A: Set the `stack` parameter of `Serie`, the series will stack in a bar with the same `stack`.
|
||||
## how-to-make-the-bar-serie-in-the-same-bar-but-not-stack
|
||||
|
||||
## How-to-make-the-bar-serie-in-the-same-bar-but-not-stack
|
||||
Set the `barGap` of `Serie` to `-1`,`stack` to null.
|
||||
|
||||
A: Set the `barGap` of `Serie` to `-1`,`stack` to null.
|
||||
## how-to-adjust-the-bar-width-and-gap-of-barchart
|
||||
|
||||
## How-to-adjust-the-bar-width-and-gap-of-barchart
|
||||
Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
|
||||
|
||||
A: Adjust the `barWidth` and `barGap` parameter of `Serie`, the last `serie`'s `barWidth` and `barGap` are valid when multiple `serie`.
|
||||
## how-to-adjust-the-color-of-bar
|
||||
|
||||
## How-to-adjust-the-color-of-bar
|
||||
Adjust the `ItemStyle` of `Data` in `inspector`.
|
||||
|
||||
A: Adjust the `ItemStyle` of `Data` in `inspector`.
|
||||
## can-i-adjust-the-anchor-of-chart
|
||||
|
||||
## Can-I-adjust-the-anchor-of-chart
|
||||
Yes, you can set any one of 16 anchors but the value use default.
|
||||
|
||||
A: Yes, you can set any one of 16 anchors but the value use default.
|
||||
## can-display-more-than-1000-data
|
||||
|
||||
## Can-display-more-than-1000-data
|
||||
Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
|
||||
|
||||
A: Yes. But `UGUI` limits `65000` vertices to a single `Graphic`, so too much data may not be displayed completely. The sampling simplification curve can be turned on by setting the sampling distance `sampleDist`. You can also set some parameters to reduce the number of vertices in the chart to help show more data. Such as reducing the size of the chart, close or reduce the axis of the client drawing, close `Symbol` and `Label` display. A `Normal` line chart occupies fewer vertices than a `Smooth` line chart. The `1.5.0` and above versions can set `large` and `largeThreshold` parameters to enable performance mode.
|
||||
## can-line-chart-drawing-be-dash-dot-and-dash-dot
|
||||
|
||||
## Can-line-chart-drawing-be-dash-dot-and-dash-dot
|
||||
Yes. Adjust the `lineType` of `Serie`.
|
||||
|
||||
A: Yes. Adjust the `lineType` of `Serie`.
|
||||
## how-to-limit-the-value-range-of-the-y-axis
|
||||
|
||||
## How-to-limit-the-value-range-of-the-Y-axis
|
||||
Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
|
||||
|
||||
A: Select the `minMaxType` of `Axis` as `Custom`, then set `min` and `max` to the values you want.
|
||||
## how-to-customize-the-tick-value-range-of-value-axis
|
||||
|
||||
## How-to-customize-the-tick-value-range-of-value-axis
|
||||
By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
|
||||
|
||||
A: By default, it is automatically split by the `splitNumber` of `Axis`. Also, you can customize the `interval` to the range you want.
|
||||
## how-to-display-text-at-the-top-of-data-items
|
||||
|
||||
## How-to-display-text-at-the-top-of-data-items
|
||||
Adjust the `Label` of `Serie`.
|
||||
|
||||
A: Adjust the `Label` of `Serie`.
|
||||
## how-do-i-customize-icons-for-data-items
|
||||
|
||||
## How-do-I-customize-icons-for-data-items
|
||||
Set the `Icon` of `Data` in `Serie`.
|
||||
|
||||
A: Set the `Icon` of `Data` in `Serie`.
|
||||
## how-to-anti-aliasing-and-make-the-chart-smoother
|
||||
|
||||
## How-to-anti-aliasing-and-make-the-chart-smoother
|
||||
Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
|
||||
|
||||
A: Open the `Anti-Aliasing` setting in `Unity`. Selected the UI Canvas `Render Mode` as `Screen Space-Camera`, selected `MSAA`, set `4` times or higher anti-aliasing. The sawtooth can only be reduced and unavoidable. The higher the pixel, the less obvious the sawtooth is.
|
||||
## why-does-mouse-over-chart-tooltip-not-show
|
||||
|
||||
## Why-does-mouse-over-chart-Tooltip-not-show
|
||||
Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
|
||||
|
||||
A: Verify `Toolip` is opened. Verify that the parent node of chart has turned off mouse events.
|
||||
## how-not-to-display-the-bar-line-of-tooltip
|
||||
|
||||
## How-not-to-display-the-bar-line-of-Tooltip
|
||||
Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
|
||||
|
||||
A: Set the `type` of `Tooltup` as `None`. Or adjust the parameters of `lineStyle`.
|
||||
## how-do-i-customize-the-display-of-tooltip
|
||||
|
||||
## How-do-I-customize-the-display-of-Tooltip
|
||||
See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
|
||||
|
||||
A: See the `formatter`, `itemFormatter`, `titleFormatter` parameters of `Tooltip`.
|
||||
## how-do-i-get-the-y-axis-to-display-multiple-decimal-places
|
||||
|
||||
## How-do-I-get-the-Y-axis-to-display-multiple-decimal-places
|
||||
Set the `numericFormatter` parameter of `AxisLabel`.
|
||||
|
||||
A: Set the `numericFormatter` parameter of `AxisLabel`.
|
||||
## how-do-i-dynamically-update-data-with-code
|
||||
|
||||
## How-do-I-dynamically-update-data-with-code
|
||||
See example: `Example01_UpdateData.cs`
|
||||
|
||||
A: See example: `Example01_UpdateData.cs`
|
||||
## how-to-display-legend-why-are-legends-sometimes-not-displayed
|
||||
|
||||
## How-to-display-legend?Why-are-legends-sometimes-not-displayed
|
||||
First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
|
||||
|
||||
A: First, the `name` in `Serie` must have a value that is not null. Then set `Legend` is `show`, where `data` can be empty by default, indicating that all legends are displayed. If you only want to display part of the `Serie` legend, fill in `data` with the `name` of the legend you want to display. If none of the values in `data` are `name` of the series, the legend will not be displayed.
|
||||
## how-to-make-chart-as-prefab
|
||||
|
||||
## How-to-make-chart-as-prefab
|
||||
Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
|
||||
|
||||
A: Before make prefab, please delete all sub gameObject under chart which auto-created by `XCharts`.
|
||||
## how-do-i-draw-custom-content-in-chart-such-as-line-or-dot
|
||||
|
||||
## How-do-I-draw-custom-content-in-chart-such-as-line-or-dot
|
||||
Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
|
||||
|
||||
A: Implement `onCustomDraw` of chart, see `Example12_CustomDrawing.cs`.
|
||||
## how-to-achieve-similar-data-movement-effect-of-electro-cardiogram
|
||||
|
||||
## How-to-achieve-similar-data-movement-effect-of-ELECTRO-cardiogram
|
||||
See `Example_Dynamic.cs`.
|
||||
|
||||
A: See `Example_Dynamic.cs`.
|
||||
## how-do-i-use-the-background-component-what-are-the-conditions
|
||||
|
||||
## How-do-I-use-the-background-component-What-are-the-conditions
|
||||
Setting `show` to `true` for the `background` component.
|
||||
|
||||
A: Setting `show` to `true` for the `background` component.
|
||||
## mesh-cannot-have-more-than-65000-vertices
|
||||
|
||||
## Mesh-cannot-have-more-than-65000-vertices
|
||||
This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [FAQ 10: Can display more than 1000 data](#can-display-more-than-1000-data)
|
||||
|
||||
A: This is the limit of `UGUI` on the number of vertices for a single `Graphic`. `XCharts` is draw chart on a single `Graphic`, so there is also this limitation. The solution can be referred to: [QA 10: Can display more than 1000 data](#Can-display-more-than-1000-data)
|
||||
## why-are-the-parameters-set-in-serie-reset-after-they-run
|
||||
|
||||
## Why-are-the-parameters-set-in-Serie-reset-after-they-run
|
||||
Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
|
||||
|
||||
A: Check whether `RemoveData()` and add new `Serie` in the code. If you want to keep the configuration of `Serie`, you can only `ClearData()` which just clear data and then readd the data to the old serie.
|
||||
## how-to-change-the-color-of-serie-symbol
|
||||
|
||||
[XCharts Homepage](https://github.com/XCharts-Team/XCharts)<br/>
|
||||
[XCharts API](XChartsAPI-EN.md)<br/>
|
||||
[XCharts Configuration](XChartsConfiguration-EN.md)
|
||||
The color of 'Symbol' is the color of 'ItemStyle' used.
|
||||
|
||||
## what-if-tmp-errors-occur-when-importing-or-updating-xcharts
|
||||
|
||||
XCharts does not enable TMP by default, so there are no references to TMP on asmdef. This issue may occur when updating XCharts after TMP is enabled locally. It can be solved in the following two ways:
|
||||
|
||||
1. Find `XCharts.Runtime.asmdef` and `XCharts.Editor.asmdef` and manually add references to `TextMeshPro`
|
||||
2. Remove the `dUI_TextMeshPro` macro for Scripting Define Symbols in PlayerSetting
|
||||
|
||||
Version ` 3.8.0 ` after adding Daemon [XCharts - Daemon](https://github.com/XCharts-Team/XCharts-Daemon), will be XCharts - Daemon import project, When updating XCharts, the daemon automatically refreshes the asmdef based on the locally enabled TMP to ensure proper compilation.
|
||||
|
||||
## support-empty-data-how-to-achieve-the-effect-of-line-chart-disconnection
|
||||
|
||||
`data` of `Serie` is of type `double`, so it cannot represent empty data. Empty data can be achieved by turning on Serie's ignore and specifying ignoreValue. You can also set the ignore parameter for each SerieData. The ignoreLineBreak parameter can be set to disconnect or connect after ignoring data.
|
||||
|
||||
## what-are-the-common-problems-when-upgrading-xcharts2-to-xcharts3
|
||||
|
||||
1. `XCharts.Runtime.XChartsMgr` is missing the class attribute `ExtensionOfNativeClass`!
|
||||
3.x version does not need to mount XChartsMgr, directly delete the `_xcharts_` node on the scene.
|
||||
|
||||
@@ -99,7 +99,7 @@ Usually, `0000` indicates the theme default color, and 0 or null indicates the t
|
||||
|
||||
Attach the `LineChart` script to the gameObject:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
@@ -110,20 +110,20 @@ if (chart == null)
|
||||
|
||||
Resize:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTransform,或直接在Inspector上改
|
||||
```
|
||||
|
||||
Set the title:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple Line";
|
||||
```
|
||||
|
||||
Set whether prompt boxes and legends are displayed:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var tooltip = chart.EnsureChartComponent<Tooltip>();
|
||||
tooltip.show = true;
|
||||
|
||||
@@ -133,7 +133,7 @@ legend.show = false;
|
||||
|
||||
Set axes:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
@@ -145,14 +145,14 @@ yAxis.type = Axis.AxisType.Value;
|
||||
|
||||
Clear default data and add `Line` type `Serie` for receiving data:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>("line");
|
||||
```
|
||||
|
||||
Add 10 data:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
@@ -214,7 +214,7 @@ All parameters seen on Inspector can be modified with code, the key is to identi
|
||||
|
||||
You need to obtain the component first, and then modify the parameters in it:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple LineChart";
|
||||
title.subText = "normal line";
|
||||
@@ -231,7 +231,7 @@ xAxis.type = Axis.AxisType.Category;
|
||||
|
||||
For newly added Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serie = chart.AddSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -243,7 +243,7 @@ serie.roundCap = true;
|
||||
|
||||
For existing Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serie = chart.GetSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -255,7 +255,7 @@ serie.roundCap = true;
|
||||
|
||||
Add additional components to Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
serie.EnsureComponent<AreaStyle>();
|
||||
|
||||
var label = serie1.EnsureComponent<LabelStyle>();
|
||||
@@ -264,7 +264,7 @@ label.offset = new Vector3(0,20,0);
|
||||
|
||||
### Change the parameter on the data item SerieData
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serieData = chart.AddData(0, 20);
|
||||
//var serieData = serie.GetSerieData(0); //从已有数据中获取
|
||||
serieData.radius = 10;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,10 @@ slug: /changelog
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.10.2](#v3102)
|
||||
[v3.10.1](#v3101)
|
||||
[v3.10.0](#v3100)
|
||||
[v3.9.0](#v390)
|
||||
[v3.8.1](#v381)
|
||||
[v3.8.0](#v380)
|
||||
[v3.7.0](#v370)
|
||||
@@ -69,6 +73,98 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
## v3.10.2
|
||||
|
||||
* (2024.03.11) 发布`v3.10.2`版本
|
||||
* (2024.03.11) 修复`Legend`的`formatter`在设置`{d}`通配符时显示可能不匹配的问题 (#304)
|
||||
* (2024.03.11) 修复`Tooltip`移出坐标系后还显示的问题
|
||||
* (2024.03.08) 修复`Tooltip`的`title`从旧版本升级后可能不显示的问题
|
||||
|
||||
## v3.10.1
|
||||
|
||||
* (2024.02.21) 发布`v3.10.1`版本
|
||||
* (2024.02.19) 修复`Tooltip`的圆点标记不会自适应颜色的问题
|
||||
|
||||
## v3.10.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加双类目轴支持
|
||||
* 增加更多细分快捷菜单创建图表,可一键创建几十种图表
|
||||
* 增加图表边框设置,支持圆角图表
|
||||
* 修复若干问题
|
||||
|
||||
扩展功能:
|
||||
|
||||
* 增加`SankeyChart`桑基图
|
||||
* 增加`UITable`的边框设置
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2024.02.01) 发布`v3.10.0`版本
|
||||
* (2024.01.31) 修复`Tooltip`在设置`itemFormatter`为`-`后整个不显示的问题
|
||||
* (2024.01.27) 修复`TextLimit`在开启`TextMeshPro`后无效的问题 (#301)
|
||||
* (2024.01.24) 增加`Bar`支持X轴和Y轴都为`Category`类目轴
|
||||
* (2024.01.23) 增加`{y}`通配符用于获取Y轴的类目名
|
||||
* (2024.01.23) 增加`Line`支持X轴和Y轴都为`Category`类目轴
|
||||
* (2024.01.18) 修复`Animation`的`type`代码动态修改无效的问题
|
||||
* (2024.01.13) 增加`Chart`的更多快捷创建图表菜单
|
||||
* (2024.01.09) 增加`Background`的`borderStyle`,给图表默认设置圆角
|
||||
* (2024.01.07) 修复`Tooltop`的第一个`ContentLabelStyle`设置`color`无效的问题
|
||||
* (2024.01.01) 增加`BorderStyle`边框样式
|
||||
* (2023.12.26) 增加`Heatmap`的`maxCache`参数支持
|
||||
* (2023.12.25) 优化`Line`开启`clip`时绘制的顶点数
|
||||
* (2023.12.22) 修复`Scatter`散点图部分边界数据不显示的问题
|
||||
* (2023.12.21) 修复`TriggerTooltip()`接口在指定0或最大index时可能无法触发的问题
|
||||
* (2023.12.19) 修复`Legend`的`LabelStyle`设置`formatter`后不生效的问题
|
||||
* (2023.12.12) 增加`Legend`的`TextLimit`可限制图例显示文本的长度
|
||||
* (2023.12.11) 修复`Serie`添加`double.MaxValue`时坐标绘制失败的问题
|
||||
* (2023.12.10) 增加`Serie`的`minShowLabel`可隐藏小于指定值的`label`
|
||||
* (2023.12.09) 增加`LevelStyle`的`depth`指定所属层次
|
||||
* (2023.12.09) 增加`LevelStyle`的`LineStyle`设置线条样式
|
||||
* (2023.12.09) 增加`Serie`的`Link`可用于桑基图添加节点边关系
|
||||
* (2023.12.05) 增加`ResetChartStatus()`可主动重置图表状态
|
||||
|
||||
## v3.9.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`Axis`的`Animation`,完善数据变更动画效果
|
||||
* 增加`Axis`的对数轴子刻度的支持
|
||||
* 增加`MarkLine`的`onTop`设置是否显示在最上层
|
||||
* 完善代码注释和手册文档
|
||||
* 修复若干问题
|
||||
|
||||
扩展功能:
|
||||
|
||||
* `UITable`增加轮播功能
|
||||
* `UITable`增加数据操作接口和回调函数
|
||||
* `Pie3DChart`优化绘制表现
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2023.12.01) 发布`v3.9.0`版本
|
||||
* (2023.12.01) 修复`Tooltip`的`titleFormatter`设置为`{b}`后显示不准确的问题
|
||||
* (2023.11.30) 增加`SerieData`可单独添加`Label`的支持
|
||||
* (2023.11.28) 修复`Tooltip`在对数轴时指示不准确的问题
|
||||
* (2023.11.24) 修复`Chart`的`UpdateData()`接口返回值不准确的问题
|
||||
* (2023.11.24) 修复`Axis`的更新数据时效果不顺畅的问题
|
||||
* (2023.11.23) 增加`Axis`的`Animation`支持动画效果
|
||||
* (2023.11.16) 取消`Legend`的`formatter`,用`LabelStyle`的代替
|
||||
* (2023.11.14) 完善`LabelStyle`的`formatter`的注释和文档(#291)
|
||||
* (2023.11.11) 修复`Documentation`部分注释生成文档不完整的问题 (#290)
|
||||
* (2023.11.11) 修复`Legend`的`formatter`在数据变更时没有自动刷新的问题
|
||||
* (2023.11.05) 修复`SerieEventData`的`value`一直是0的问题 (#287)
|
||||
* (2023.11.03) 修复`Bar`设置渐变色时鼠标移出效果异常的问题 (#285)
|
||||
* (2023.11.02) 优化`SerieData`设置`ignore`时`formatter`的忽略问题
|
||||
* (2023.11.01) 增加`MarkLine`的`onTop`设置是否显示在最上层
|
||||
* (2023.10.21) 修复`Pie`有0数据时`Label`的位置异常的问题
|
||||
* (2023.10.21) 增加`Axis`的对数轴支持子刻度
|
||||
* (2023.10.19) 修复`Pie`设置玫瑰图时引导线异常的问题
|
||||
* (2023.10.15) 修复`Line`设置`Animation`为`AlongPath`时动画异常的问题 (#281)
|
||||
* (2023.10.12) 修复`MarkLine`指定`yValue`时对数值轴无效的问题
|
||||
* (2023.10.11) 修复`Serie`的`showDataDimension`设置无效的问题
|
||||
|
||||
## v3.8.1
|
||||
|
||||
* (2023.10.02) 发布`v3.8.1`版本
|
||||
@@ -109,7 +205,7 @@ slug: /changelog
|
||||
* (2023.08.22) 修复`Bar`显示隐藏时绘制表现异常的问题
|
||||
* (2023.08.22) 优化`Zebra`斑马柱图的绘制表现 (#276)
|
||||
* (2023.08.16) 增加`Daemon`守护程序,解决本地开启TMP后更新版本报错问题
|
||||
* (2023.08.15) 修复`Data`数据在-1到1之间时坐标轴显示错误的问题 (#273) (by __Ambitroc__)
|
||||
* (2023.08.15) 修复`Data`数据在-1到1之间时坐标轴显示错误的问题 (#273) (by **Ambitroc**)
|
||||
* (2023.08.14) 修复`XCharts`本地开启`TextMeshPro`和 `NewInputSystem`后更新版本会报错的问题 (#272)
|
||||
* (2023.08.12) 修复`Chart`在运行时被删除时会异常报错的问题 (#269)
|
||||
* (2023.08.11) 修复`DataZoom`开启时可能会导致无法添加数据的问题
|
||||
@@ -150,7 +246,7 @@ slug: /changelog
|
||||
|
||||
* (2023.06.08) 发布`v3.7.0`版本
|
||||
* (2023.06.04) 增加`HelpDoc`帮助文档跳转
|
||||
* (2023.05.30) 修复`Serie`的名字带`_`线导致`Legend`无法触发的问题 (#259) (by __svr2kos2__)
|
||||
* (2023.05.30) 修复`Serie`的名字带`_`线导致`Legend`无法触发的问题 (#259) (by **svr2kos2**)
|
||||
* (2023.05.10) 增加`Axis`的`MinMaxAuto`范围类型
|
||||
* (2023.05.10) 增加`Line`对`Clip`的支持
|
||||
* (2023.05.04) 优化`Axis`在-1到1范围时设置`CeilRate`不生效的问题
|
||||
@@ -169,9 +265,9 @@ slug: /changelog
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`InputSystem`支持 (by __Bian-Sh__)
|
||||
* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by __SHL-COOL__)
|
||||
* 完善对`VR`的支持 (by __Ambitroc__)
|
||||
* 增加`InputSystem`支持 (by **Bian-Sh**)
|
||||
* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by **SHL-COOL**)
|
||||
* 完善对`VR`的支持 (by **Ambitroc**)
|
||||
* 增加`UITable`,`UIStatistic`等[扩展UI组件](https://xcharts-team.github.io/docs/ui)
|
||||
* 增加`ItemStyle`的`MarkColor`
|
||||
* 增加通配符`{h}`的支持
|
||||
@@ -187,9 +283,9 @@ slug: /changelog
|
||||
|
||||
* (2023.04.01) 发布`v3.6.0`版本
|
||||
* (2023.03.14) 修复`Tooltip`的`titleFormater`设置`{b}`可能不生效的问题
|
||||
* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by __Ambitroc__)
|
||||
* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by **Ambitroc**)
|
||||
* (2023.03.12) 增加`LabelStyle`的`autoRotate`可设置有角度的竖版文本的自动旋转
|
||||
* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by __Ambitroc__)
|
||||
* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by **Ambitroc**)
|
||||
* (2023.03.09) 增加`Chart`的`onSerieClick`,`onSerieDown`,`onSerieEnter`和`onSerieExit`回调
|
||||
* (2023.03.09) 修复`Pie`的点击选中偏移不生效的问题
|
||||
* (2023.03.04) 增加`Legend`的`Positions`可自定义图例的位置
|
||||
@@ -203,7 +299,7 @@ slug: /changelog
|
||||
* (2023.02.02) 修复`DataZoom`开启时`X轴`的`Label`可能会显示在图表外的问题
|
||||
* (2023.02.02) 优化`SerieData`的`ignore`设置时的忽略数据判断
|
||||
* (2023.02.01) 修复`XChartsMgr.ContainsChart()`接口异常
|
||||
* (2023.01.31) 增加`InputSystem`的支持 (#242) (by __Bian-Sh__)
|
||||
* (2023.01.31) 增加`InputSystem`的支持 (#242) (by **Bian-Sh**)
|
||||
* (2023.01.11) 修复`Inspector`上移除`Component`后图表没有及时刷新的问题 (#241)
|
||||
* (2023.01.06) 修复`Pie`在最后的几个数据都为0时`Label`显示不正常的问题 (#240)
|
||||
* (2023.01.03) 删除`Serie`的`MarkColor`,增加`ItemStyle`的`MarkColor`
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,161 +5,164 @@ slug: /faq
|
||||
|
||||
# 常见问题
|
||||
|
||||
[QA 1:如何调整坐标轴与背景的边距?](#如何调整坐标轴与背景的边距)
|
||||
[QA 2:如何让初始动画重新播放?](#如何让初始动画重新播放)
|
||||
[QA 3:如何自定义折线图饼图的颜色?](#如何自定义折线图饼图的颜色)
|
||||
[QA 4:如何给坐标轴上的文本加上单位?](#如何给坐标轴上的文本加上单位)
|
||||
[QA 5:如何让柱形图的柱子堆叠显示?](#如何让柱形图的柱子堆叠显示)
|
||||
[QA 6:如何让柱形图的柱子同柱但不重叠?](#如何让柱形图的柱子同柱但不重叠)
|
||||
[QA 7:如何调整柱形图的柱子宽度和间距?](#如何调整柱形图的柱子宽度和间距)
|
||||
[QA 8:如何调整柱形图单个柱子的颜色?](#如何调整柱形图单个柱子的颜色)
|
||||
[QA 9:如何调整图表的对齐方式?](#如何调整图表的对齐方式)
|
||||
[QA 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
[QA 11:折线图可以画虚线、点线、点划线吗?](#折线图可以画虚线点线点划线吗)
|
||||
[QA 12:如何限定Y轴的值范围?](#如何限定Y轴的值范围)
|
||||
[QA 13:如何自定义数值轴刻度大小?](#如何自定义数值轴刻度大小)
|
||||
[QA 14:如何在数据项顶上显示文本?](#如何在数据项顶上显示文本)
|
||||
[QA 15:如何给数据项自定义图标?](#如何给数据项自定义图标)
|
||||
[QA 16:锯齿太严重,如何让图表更顺滑?](#锯齿太严重如何让图表更顺滑)
|
||||
[QA 17:为什么鼠标移上图表 Tooltip 不显示?](#为什么鼠标移上图表Tooltip不显示)
|
||||
[QA 18:如何取消 Tooltip 的竖线?](#如何取消Tooltip的竖线)
|
||||
[QA 19:如何自定义 Tooltip 的显示内容?](#如何自定义Tooltip的显示内容)
|
||||
[QA 20:如何让Y轴显示多位小数?](#如何让Y轴显示多位小数)
|
||||
[QA 21:如何用代码动态更新数据?](#如何用代码动态更新数据)
|
||||
[QA 22:如何显示图例?为什么有时候图例无法显示?](#如何显示图例为什么有时候图例无法显示)
|
||||
[QA 23:如何做成预设?](#如何做成预设)
|
||||
[QA 24:如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
|
||||
[QA 25:如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
|
||||
[QA 26:如何使用背景组件?有什么条件限制?](#如何使用背景组件有什么条件限制)
|
||||
[QA 27:Mesh can not have more than 65000 vertices?](#Mesh_cannot_have_more_than_65000_vertices)
|
||||
[QA 28:为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
|
||||
[QA 29:如何修改Serie的Symbol的颜色?](#如何修改Serie的Symbol的颜色)
|
||||
[QA 30:导入或更新XCharts时TMP报错如何处理?](#导入或更新XCharts时TMP报错怎么办)
|
||||
[QA 31:支持空数据吗?如何实现折线图断开的效果?](#支持空数据吗如何实现折线图断开的效果)
|
||||
[FAQ 1:如何调整坐标轴与背景的边距?](#如何调整坐标轴与背景的边距)
|
||||
[FAQ 2:如何让初始动画重新播放?](#如何让初始动画重新播放)
|
||||
[FAQ 3:如何自定义折线图饼图的颜色?](#如何自定义折线图饼图的颜色)
|
||||
[FAQ 4:如何给坐标轴上的文本加上单位?](#如何给坐标轴上的文本加上单位)
|
||||
[FAQ 5:如何让柱形图的柱子堆叠显示?](#如何让柱形图的柱子堆叠显示)
|
||||
[FAQ 6:如何让柱形图的柱子同柱但不重叠?](#如何让柱形图的柱子同柱但不重叠)
|
||||
[FAQ 7:如何调整柱形图的柱子宽度和间距?](#如何调整柱形图的柱子宽度和间距)
|
||||
[FAQ 8:如何调整柱形图单个柱子的颜色?](#如何调整柱形图单个柱子的颜色)
|
||||
[FAQ 9:如何调整图表的对齐方式?](#如何调整图表的对齐方式)
|
||||
[FAQ 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
[FAQ 11:折线图可以画虚线、点线、点划线吗?](#折线图可以画虚线点线点划线吗)
|
||||
[FAQ 12:如何限定Y轴的值范围?](#如何限定y轴的值范围)
|
||||
[FAQ 13:如何自定义数值轴刻度大小?](#如何自定义数值轴刻度大小)
|
||||
[FAQ 14:如何在数据项顶上显示文本?](#如何在数据项顶上显示文本)
|
||||
[FAQ 15:如何给数据项自定义图标?](#如何给数据项自定义图标)
|
||||
[FAQ 16:锯齿太严重,如何让图表更顺滑?](#锯齿太严重如何让图表更顺滑)
|
||||
[FAQ 17:为什么鼠标移上图表Tooltip不显示?](#为什么鼠标移上图表tooltip不显示)
|
||||
[FAQ 18:如何取消Tooltip的竖线?](#如何取消tooltip的竖线)
|
||||
[FAQ 19:如何自定义Tooltip的显示内容?](#如何自定义tooltip的显示内容)
|
||||
[FAQ 20:如何让y轴显示多位小数?](#如何让y轴显示多位小数)
|
||||
[FAQ 21:如何用代码动态更新数据?](#如何用代码动态更新数据)
|
||||
[FAQ 22:如何显示图例?为什么有时候图例无法显示?](#如何显示图例为什么有时候图例无法显示)
|
||||
[FAQ 23:如何做成预设?](#如何做成预设)
|
||||
[FAQ 24:如何在图表上画点画线等自定义内容?](#如何在图表上画点画线等自定义内容)
|
||||
[FAQ 25:如何实现心电图类似的数据移动效果?](#如何实现心电图类似的数据移动效果)
|
||||
[FAQ 26:如何使用背景组件?有什么条件限制?](#如何使用背景组件有什么条件限制)
|
||||
[FAQ 27:Mesh can not have more than 65000 vertices?](#mesh_cannot_have_more_than_65000_vertices)
|
||||
[FAQ 28:为什么serie里设置的参数运行后又被重置了?](#为什么serie里设置的参数运行后又被重置了)
|
||||
[FAQ 29:如何修改serie的symbol的颜色?](#如何修改serie的symbol的颜色)
|
||||
[FAQ 30:导入或更新XCharts时TMP报错如何处理?](#导入或更新xcharts时tmp报错怎么办)
|
||||
[FAQ 31:支持空数据吗?如何实现折线图断开的效果?](#支持空数据吗如何实现折线图断开的效果)
|
||||
[FAQ 32:2.x版本升级3.x版本时常见的问题有哪些?](#xcharts2升级xcharts3时常见的问题有哪些)
|
||||
[FAQ 33:折线图如何两边不留空白而从0坐标开始显示?](#折线图如何两边不留空白而从0坐标开始显示)
|
||||
[FAQ 34:如何设置部分Serie不显示Tooltip?](#如何设置部分serie不显示tooltip)
|
||||
|
||||
## 如何调整坐标轴与背景的边距
|
||||
|
||||
答:调整`Grid`组件,可调整上下左右边距。
|
||||
调整`Grid`组件,可调整上下左右边距。
|
||||
|
||||
## 如何让初始动画重新播放
|
||||
|
||||
答:调用`chart.AnimationReset()`接口。
|
||||
调用`chart.AnimationReset()`接口。
|
||||
|
||||
## 如何自定义折线图饼图的颜色
|
||||
|
||||
答:通过`Theme`的`colorPalette`调整,或者部分`Serie`下的`LineStyle`和`ItemStyle`。
|
||||
通过`Theme`的`colorPalette`调整,或者部分`Serie`下的`LineStyle`和`ItemStyle`。
|
||||
|
||||
## 如何给坐标轴上的文本加上单位
|
||||
|
||||
答:通过`formatter`和`numericFormatter`参数,在`Legend`、`Axis`的`AxisLabel`、`Tooltop`、`Serie`的`Label`都提供该参数的配置。
|
||||
通过`formatter`和`numericFormatter`参数,在`Legend`、`Axis`的`AxisLabel`、`Tooltop`、`Serie`的`Label`都提供该参数的配置。
|
||||
|
||||
## 如何让柱形图的柱子堆叠显示
|
||||
|
||||
答:设置`Serie`下的`stack`,`stack`相同的`serie`会堆叠显示在一个柱子上。
|
||||
设置`Serie`下的`stack`,`stack`相同的`serie`会堆叠显示在一个柱子上。
|
||||
|
||||
## 如何让柱形图的柱子同柱但不重叠
|
||||
|
||||
答:设置`Serie`下的`barGap`为`-1`,`stack`为空。
|
||||
设置`Serie`下的`barGap`为`-1`,`stack`为空。
|
||||
|
||||
## 如何调整柱形图的柱子宽度和间距
|
||||
|
||||
答:调整`Serie`下的`barWidth`和`barGap`,多个`serie`时最后一个`serie`的`barWidth`和`barGap`有效。
|
||||
调整`Serie`下的`barWidth`和`barGap`,多个`serie`时最后一个`serie`的`barWidth`和`barGap`有效。
|
||||
|
||||
## 如何调整柱形图单个柱子的颜色
|
||||
|
||||
答:可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
|
||||
可通过调整单个`Data`下的`ItemStyle`调整,也可以通过两个`serie`同柱不堆叠来实现,通过设置数据项为`0`来达到类似效果。
|
||||
|
||||
## 如何调整图表的对齐方式
|
||||
|
||||
答:调整RectTransform的锚点,和UGUI的其他组件的用法一致。
|
||||
调整RectTransform的锚点,和UGUI的其他组件的用法一致。
|
||||
|
||||
## 可以显示超过1000以上的大数据吗
|
||||
|
||||
答:可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie`的`symbol`和`label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large`和`largeThreshold`参数来开启性能模式。
|
||||
可以。但`UGUI`对单个`Graphic`限制`65000`个顶点,所以太多的数据不一定能显示完全。可通过设置采样距离`sampleDist`开启采样简化过密曲线。也可以通过设置一些参数来减少图表的顶点数有助于显示更多数据。如缩小图表的尺寸,关闭或减少坐标轴的客户端绘制,关闭`Serie`的`symbol`和`label`显示等。折线图的普通线图`Normal`比平滑线图`Smooth`占用顶点数更少。`1.5.0`以上版本可以设置`large`和`largeThreshold`参数来开启性能模式。
|
||||
|
||||
## 折线图可以画虚线点线点划线吗
|
||||
|
||||
答:可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
|
||||
可以。通过`Serie`下的`lineType`选择线条样式。当要显示的数据过多(成千以上)数据间过密时建议使用`Normal`或者`Step`样式。
|
||||
|
||||
## 如何限定Y轴的值范围
|
||||
## 如何限定y轴的值范围
|
||||
|
||||
答:设置`Axis`下的`minMaxType`为`Custom`,自定义`min`和`max`。
|
||||
设置`Axis`下的`minMaxType`为`Custom`,自定义`min`和`max`。
|
||||
|
||||
## 如何自定义数值轴刻度大小
|
||||
|
||||
答:默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
|
||||
默认时通过`Axis`下的`splitNumer`进行自动划分。也可以设置`interval`自定义刻度大小。
|
||||
|
||||
## 如何在数据项顶上显示文本
|
||||
|
||||
答:通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
|
||||
通过设置`Serie`下的`Label`。3.0版本需要先添加`LabelStyle`组件。
|
||||
|
||||
## 如何给数据项自定义图标
|
||||
|
||||
答:通过设置`Serie`的`data`下的数据项可单独设置`icon`相关参数。
|
||||
通过设置`Serie`的`data`下的数据项可单独设置`icon`相关参数。
|
||||
|
||||
## 锯齿太严重如何让图表更顺滑
|
||||
|
||||
答:开启抗锯齿设置(在`Unity`里设置)。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
|
||||
开启抗锯齿设置(在`Unity`里设置)。调整UI渲染模式为`Camera`模式,开启`MSAA`,设置`4`倍或更高抗锯齿。
|
||||
|
||||
## 为什么鼠标移上图表Tooltip不显示
|
||||
## 为什么鼠标移上图表tooltip不显示
|
||||
|
||||
答:确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
|
||||
确认`Tooltip`是否开启;确认父节点是否关闭了鼠标事件。
|
||||
|
||||
## 如何取消Tooltip的竖线
|
||||
## 如何取消tooltip的竖线
|
||||
|
||||
答:设置`Tooltip`的`type`为`None`。或者调整`lineStyle`的参数。
|
||||
设置`Tooltip`的`type`为`None`。或者调整`lineStyle`的参数。
|
||||
|
||||
## 如何自定义Tooltip的显示内容
|
||||
## 如何自定义tooltip的显示内容
|
||||
|
||||
答:自定义总的内容可以通过`Tooltip`的`formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter`和`titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie`的`itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
|
||||
自定义总的内容可以通过`Tooltip`的`formatter`。如果只是想调整所有的`serie`的显示格式可以用`itemFormatter`和`titleFormatter`结合。如果想每个`serie`的显示格式不一样,可以定制`serie`的`itemStyle`里的`tooltipFormatter`。具体的用法请查阅[XCharts配置项手册](https://xcharts-team.github.io/docs/configuration#Tooltip-itemFormatter)。
|
||||
|
||||
## 如何让Y轴显示多位小数
|
||||
## 如何让y轴显示多位小数
|
||||
|
||||
答:设置`Axis`下的`AxisLabel`中的`formatter`为`{value:f1}`或`{value:f2}`。`1.5.0`及以上版本通过`numericFormatter`设置。
|
||||
设置`Axis`下的`AxisLabel`中的`formatter`为`{value:f1}`或`{value:f2}`。`1.5.0`及以上版本通过`numericFormatter`设置。
|
||||
|
||||
## 如何用代码动态更新数据
|
||||
|
||||
答:请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能,相关API请查看文档:[XChartsAPI接口](api.md) 。
|
||||
请查阅`Example`下的代码,`Example13_LineSimple.cs`就是一个简单添加数据构建折线图的例子,其他`Demo`也都是通过代码控制不同的组件实现不同的功能,相关API请查看文档:[XChartsAPI接口](api.md) 。
|
||||
|
||||
## 如何显示图例为什么有时候图例无法显示
|
||||
|
||||
答:首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
|
||||
首先,你的`serie`里的`name`需有值不为空。然后开启`Legend`显示,里面的`data`可以默认为空,表示显示所有的图例。如果你只想显示部分`serie`的图例,在`data`中填入要显示的图例的`name`即可。如果`data`中的值都不是系列的`name`,那图例就不会显示。
|
||||
|
||||
## 如何做成预设
|
||||
|
||||
答:做成prefab前,执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
|
||||
做成prefab前,执行一下`Rebuild Chart Object`重新刷新节点,避免有冗余的节点存在。
|
||||
|
||||
## 如何在图表上画点画线等自定义内容
|
||||
|
||||
答:`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
|
||||
`XCharts`有自定义绘制回调`onCustomDraw`,具体可参考`Example12_CustomDrawing.cs`
|
||||
|
||||
## 如何实现心电图类似的数据移动效果
|
||||
|
||||
答:参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis`和`serie`都设置相同的`maxCache`。`maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
|
||||
参考`Example`目录下的`Example_Dynamic.cs`。主要通过设置`maxCache`参数实现。`axis`和`serie`都设置相同的`maxCache`。`maxCache`可固定数据个数,当数据超过设定时会先删除第一个在添加新数据,实现数据移动效果。
|
||||
|
||||
## 如何使用背景组件有什么条件限制
|
||||
|
||||
答:设置`background`组件的`show`为`true`。
|
||||
设置`background`组件的`show`为`true`。
|
||||
|
||||
## 区域折线图在用半透明颜色时有时候会一条叠加的线
|
||||
|
||||
答:这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
|
||||
这是区域折线图绘制的bug。可以用浅的不透的颜色替代半透明颜色。
|
||||
|
||||
## Mesh_cannot_have_more_than_65000_vertices
|
||||
## mesh_cannot_have_more_than_65000_vertices
|
||||
|
||||
答:这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[QA 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
这是`UGUI`对单个`Graphic`的顶点数限制。`XCharts`是将图形绘制在单个`Graphic`上,所以也会有这个限制。解决的办法可以参考:[FAQ 10:可以显示超过1000以上的大数据吗?](#可以显示超过1000以上的大数据吗)
|
||||
|
||||
## 为什么serie里设置的参数运行后又被重置了
|
||||
|
||||
答:检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
|
||||
检测下代码里是否调用了`RemoveData()`并重新添加`Serie`了。如果想保留`Serie`的配置可以只`ClearData()`,然后重新添加数据。
|
||||
|
||||
## 如何修改Serie的Symbol的颜色
|
||||
## 如何修改serie的symbol的颜色
|
||||
|
||||
答:`Symbol` 的颜色是使用的 `ItemStyle` 的 `color`。
|
||||
`Symbol` 的颜色是使用的 `ItemStyle` 的 `color`。
|
||||
|
||||
## 导入或更新XCharts时TMP报错怎么办
|
||||
## 导入或更新xcharts时tmp报错怎么办
|
||||
|
||||
答:XCharts默认时不开启TMP,所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决:
|
||||
XCharts默认时不开启TMP,所以asmdef上没有TMP的引用。当本地开启TMP后再更新XCharts可能会出现这个问题。可通过以下两种方式解决:
|
||||
|
||||
1. 找到`XCharts.Runtime.asmdef`和`XCharts.Editor.asmdef`,手动加上 `TextMeshPro`的引用
|
||||
2. 移除`PlayerSetting`中`Scripting Define Symbols`的`dUI_TextMeshPro`宏
|
||||
@@ -168,4 +171,17 @@ slug: /faq
|
||||
|
||||
## 支持空数据吗如何实现折线图断开的效果
|
||||
|
||||
答:`Serie`的`data`是`double`类型,所以无法表示空数据。可通过开启`Serie`的`ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
|
||||
`Serie`的`data`是`double`类型,所以无法表示空数据。可通过开启`Serie`的`ignore`和指定`ignoreValue`来达到空数据的效果。也可以每个`SerieData`设置`ignore`参数。忽略数据后断开还是连接可设置`ignoreLineBreak`参数。
|
||||
|
||||
## xcharts2升级xcharts3时常见的问题有哪些
|
||||
|
||||
1. 'XCharts.Runtime.XChartsMgr' is missing the class attribute 'ExtensionOfNativeClass'!
|
||||
3.x版本时不需要挂载XChartsMgr,直接删掉场景上的`_xcharts_`节点即可。
|
||||
|
||||
## 折线图如何两边不留空白而从0坐标开始显示
|
||||
|
||||
设置X轴的`boundaryGap`参数。
|
||||
|
||||
## 如何设置部分serie不显示tooltip
|
||||
|
||||
`serie`的`itemStyle`的`itemFormatter`设置为`-`可以忽略`tooltip`。
|
||||
|
||||
@@ -50,10 +50,11 @@ slug: /support
|
||||
| 扩展UI组件 | | | √ | √ | √ | √ |
|
||||
| 首页赞助展示 | | | | | | √ |
|
||||
| 付费方式 | | | 二维码 | 二维码 | __公对公转账__* | __公对公转账__* |
|
||||
| 支持开发票 | | | 普票 | 普票 | __专票__ | __专票__ |
|
||||
| 支持开发票 | | | 普票 | 普票 | __可开专票__ | __可开专票__ |
|
||||
| 扩展图表购买 | | | 按需购买 | __全部免费__* | __全部免费__* | __全部免费__* |
|
||||
| 扩展图表源码 | | | 永久持有 | 永久持有 | 永久持有 | 永久持有 |
|
||||
| 扩展图表更新 | | | 1年更新支持 | 1年更新支持 | 1年更新支持 | 1年更新支持 |
|
||||
| Github仓库 | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)<br/>[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)<br/>[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)<br/>[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)<br/>[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) | XCharts<br/>[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)<br/>[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)<br/>[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)<br/>[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) |
|
||||
|
||||
>备注:
|
||||
>*__`付费定制`__ 用户可根据自己的需求可付费定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。
|
||||
@@ -64,7 +65,7 @@ slug: /support
|
||||
>*__`次年付费`__ 个人SVIP和企业VIP的首年和次年付费不一样,次年付费都是`298¥`。
|
||||
>*__`增加席位`__ 企业VIP支持增加席位,每个席位`298¥`一年。
|
||||
>*__`对公转账`__ 有开专票需求时,可用企业银行帐号进行公对公转账支付。二维码支付不支持开专票,只能开普票。发票默认都是电子发票。
|
||||
>*__`登记资料`__ 订阅成功后,需提供手机号和Github帐号进行登记,手机号用于确认归属,Github帐号用于下载源码。
|
||||
>*__`登记资料`__ 订阅成功后,需提供手机号和Github帐号进行登记,手机号用于确认归属,Github帐号用于加入Github的Team组织,下载源码。
|
||||
|
||||
## 购买扩展图表
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ XCharts经过不断的迭代优化,目前已有多达几十种的主组件和
|
||||
|
||||
给`gameObject`挂上`LineChart`脚本:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
@@ -110,20 +110,20 @@ if (chart == null)
|
||||
|
||||
调整大小:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTransform,或直接在Inspector上改
|
||||
```
|
||||
|
||||
设置标题:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple Line";
|
||||
```
|
||||
|
||||
设置提示框和图例是否显示:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var tooltip = chart.EnsureChartComponent<Tooltip>();
|
||||
tooltip.show = true;
|
||||
|
||||
@@ -133,7 +133,7 @@ legend.show = false;
|
||||
|
||||
设置坐标轴:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.boundaryGap = true;
|
||||
@@ -145,14 +145,14 @@ yAxis.type = Axis.AxisType.Value;
|
||||
|
||||
清空默认数据,添加`Line`类型的`Serie`用于接收数据:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<Line>("line");
|
||||
```
|
||||
|
||||
添加10个数据:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
@@ -214,7 +214,7 @@ XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换
|
||||
|
||||
需要先获取组件,再修改里面的参数:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var title = chart.EnsureChartComponent<Title>();
|
||||
title.text = "Simple LineChart";
|
||||
title.subText = "normal line";
|
||||
@@ -231,7 +231,7 @@ xAxis.type = Axis.AxisType.Category;
|
||||
|
||||
对于新添加的Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serie = chart.AddSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -243,7 +243,7 @@ serie.roundCap = true;
|
||||
|
||||
对于已存在的Serie:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serie = chart.GetSerie<Pie>();
|
||||
serie.center[0] = 0.5f;
|
||||
serie.center[1] = 0.5f;
|
||||
@@ -255,7 +255,7 @@ serie.roundCap = true;
|
||||
|
||||
给Serie添加额外组件:
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
serie.EnsureComponent<AreaStyle>();
|
||||
|
||||
var label = serie1.EnsureComponent<LabelStyle>();
|
||||
@@ -264,7 +264,7 @@ label.offset = new Vector3(0,20,0);
|
||||
|
||||
### 改数据项SerieData上的参数
|
||||
|
||||
```C#
|
||||
```csharp
|
||||
var serieData = chart.AddData(0, 20);
|
||||
//var serieData = serie.GetSerieData(0); //从已有数据中获取
|
||||
serieData.radius = 10;
|
||||
|
||||
28
Editor/ChildComponents/BackgroundDrawer.cs
Normal file
28
Editor/ChildComponents/BackgroundDrawer.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Background), true)]
|
||||
public class BackgroundDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Background"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Image");
|
||||
PropertyField(prop, "m_ImageType");
|
||||
PropertyField(prop, "m_ImageColor");
|
||||
PropertyField(prop, "m_ImageWidth");
|
||||
PropertyField(prop, "m_ImageHeight");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_BorderStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe10ee35a038646b6aedfffb30f84024
|
||||
guid: 88c83fad35bc544cab4106096d171189
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
25
Editor/ChildComponents/BorderStyleDrawer.cs
Normal file
25
Editor/ChildComponents/BorderStyleDrawer.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(BorderStyle), true)]
|
||||
public class BorderStyleDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Border"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_BorderWidth");
|
||||
PropertyField(prop, "m_BorderColor");
|
||||
PropertyField(prop, "m_RoundedCorner");
|
||||
PropertyListField(prop, "m_CornerRadius", true);
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/ChildComponents/BorderStyleDrawer.cs.meta
Normal file
11
Editor/ChildComponents/BorderStyleDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47a460215ec5e4ec0bc7f8122a44302a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -27,11 +27,16 @@ namespace XCharts.Editor
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Label");
|
||||
PropertyField(prop, "m_UpperLabel");
|
||||
PropertyField(prop, "m_ItemStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
if (MakeComponentFoldout(prop, "m_Depth", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Depth");
|
||||
PropertyField(prop, "m_Label");
|
||||
PropertyField(prop, "m_UpperLabel");
|
||||
PropertyField(prop, "m_LineStyle");
|
||||
PropertyField(prop, "m_ItemStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace XCharts.Editor
|
||||
var m_Type = baseProperty.FindPropertyRelative("m_Type");
|
||||
var m_LogBase = baseProperty.FindPropertyRelative("m_LogBase");
|
||||
var m_MinMaxType = baseProperty.FindPropertyRelative("m_MinMaxType");
|
||||
var type = (Axis.AxisType) m_Type.enumValueIndex;
|
||||
var type = (Axis.AxisType)m_Type.enumValueIndex;
|
||||
EditorGUI.indentLevel++;
|
||||
if (component is ParallelAxis)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ namespace XCharts.Editor
|
||||
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
|
||||
{
|
||||
PropertyField("m_MinMaxType");
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType) m_MinMaxType.enumValueIndex;
|
||||
Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex;
|
||||
switch (minMaxType)
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
@@ -63,7 +63,6 @@ namespace XCharts.Editor
|
||||
PropertyField("m_SplitNumber");
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
//PropertyField("m_InsertDataToHead");
|
||||
PropertyField("m_MaxCache");
|
||||
PropertyField("m_BoundaryGap");
|
||||
}
|
||||
@@ -72,6 +71,10 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Interval");
|
||||
}
|
||||
DrawExtendeds();
|
||||
if (type != Axis.AxisType.Category)
|
||||
{
|
||||
PropertyField("m_Animation");
|
||||
}
|
||||
PropertyField("m_AxisLine");
|
||||
PropertyField("m_AxisName");
|
||||
PropertyField("m_AxisTick");
|
||||
@@ -89,7 +92,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
PropertyListField("m_Data", true, new HeaderMenuInfo("Import ECharts Axis Data", () =>
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, null, component as Axis);
|
||||
PraseExternalDataEditor.UpdateData(chart, null, component as Axis, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
}
|
||||
@@ -204,4 +207,21 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisAnimation), true)]
|
||||
public class AxisAnimationDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Animation"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_UnscaledTime");
|
||||
PropertyField(prop, "m_Duration");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ImageType");
|
||||
PropertyField("m_ImageColor");
|
||||
PropertyField("m_AutoColor");
|
||||
PropertyField("m_BorderStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
112
Editor/MainComponents/BaseGraphEditor.cs
Normal file
112
Editor/MainComponents/BaseGraphEditor.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class BaseGraphEditor : UnityEditor.Editor
|
||||
{
|
||||
class Styles
|
||||
{
|
||||
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
|
||||
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", "");
|
||||
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
|
||||
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
|
||||
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
|
||||
}
|
||||
public BaseGraph m_BaseGraph;
|
||||
|
||||
public static T AddUIComponent<T>(string chartName) where T : BaseGraph
|
||||
{
|
||||
return XChartsEditor.AddGraph<T>(chartName);
|
||||
}
|
||||
|
||||
protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>();
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
m_Properties.Clear();
|
||||
m_BaseGraph = (BaseGraph)target;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
PropertyField("m_Script");
|
||||
|
||||
OnStartInspectorGUI();
|
||||
OnDebugInspectorGUI();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
protected virtual void OnStartInspectorGUI() { }
|
||||
|
||||
protected virtual void OnDebugInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
OnDebugStartInspectorGUI();
|
||||
OnDebugEndInspectorGUI();
|
||||
}
|
||||
|
||||
protected virtual void OnDebugStartInspectorGUI() { }
|
||||
protected virtual void OnDebugEndInspectorGUI() { }
|
||||
|
||||
protected void PropertyField(string name)
|
||||
{
|
||||
if (!m_Properties.ContainsKey(name))
|
||||
{
|
||||
var prop = serializedObject.FindProperty(name);
|
||||
if (prop == null)
|
||||
{
|
||||
Debug.LogError("Property " + name + " not found!");
|
||||
return;
|
||||
}
|
||||
m_Properties.Add(name, prop);
|
||||
}
|
||||
EditorGUILayout.PropertyField(m_Properties[name]);
|
||||
}
|
||||
|
||||
protected void PropertyField(SerializedProperty property)
|
||||
{
|
||||
Assert.IsNotNull(property);
|
||||
var title = ChartEditorHelper.GetContent(property.displayName);
|
||||
PropertyField(property, title);
|
||||
}
|
||||
|
||||
protected void PropertyField(SerializedProperty property, GUIContent title)
|
||||
{
|
||||
EditorGUILayout.PropertyField(property, title);
|
||||
}
|
||||
|
||||
protected void PropertyListField(string relativePropName, bool showOrder = true, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||
var height = 0f;
|
||||
var prop = FindProperty(relativePropName);
|
||||
prop.isExpanded = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
|
||||
prop, prop.isExpanded, showOrder, true, menus);
|
||||
if (prop.isExpanded)
|
||||
{
|
||||
GUILayoutUtility.GetRect(1f, height - 17);
|
||||
}
|
||||
}
|
||||
|
||||
protected void PropertyTwoFiled(string relativePropName)
|
||||
{
|
||||
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
|
||||
var prop = FindProperty(relativePropName);
|
||||
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName);
|
||||
}
|
||||
|
||||
protected SerializedProperty FindProperty(string path)
|
||||
{
|
||||
if (!m_Properties.ContainsKey(path))
|
||||
{
|
||||
m_Properties.Add(path, serializedObject.FindProperty(path));
|
||||
}
|
||||
return m_Properties[path];
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/BaseGraphEditor.cs.meta
Normal file
11
Editor/MainComponents/BaseGraphEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88786092000154d359c1aa954ce664f0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -17,9 +17,9 @@ namespace XCharts.Editor
|
||||
PropertyField("m_ItemOpacity");
|
||||
PropertyField("m_SelectedMode");
|
||||
PropertyField("m_Orient");
|
||||
PropertyField("m_Formatter");
|
||||
PropertyField("m_Location");
|
||||
PropertyField("m_LabelStyle");
|
||||
PropertyField("m_TextLimit");
|
||||
PropertyField("m_Background");
|
||||
PropertyField("m_Padding");
|
||||
PropertyListField("m_Icons");
|
||||
|
||||
@@ -133,7 +133,26 @@ namespace XCharts.Editor
|
||||
|
||||
public void AddChartComponent(Type type)
|
||||
{
|
||||
chart.AddChartComponent(type);
|
||||
var component = chart.AddChartComponent(type);
|
||||
if (component != null)
|
||||
{
|
||||
if (component is YAxis)
|
||||
{
|
||||
var yAxis = component as YAxis;
|
||||
if (yAxis.index == 1)
|
||||
{
|
||||
yAxis.position = Axis.AxisPosition.Right;
|
||||
}
|
||||
}
|
||||
else if (component is XAxis)
|
||||
{
|
||||
var xAxis = component as XAxis;
|
||||
if (xAxis.index == 1)
|
||||
{
|
||||
xAxis.position = Axis.AxisPosition.Top;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_ComponentsProperty = m_BaseEditor.RefreshComponent();
|
||||
RefreshEditors();
|
||||
EditorUtility.SetDirty(chart);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_SerieIndex");
|
||||
PropertyField("m_OnTop");
|
||||
PropertyField("m_Animation");
|
||||
PropertyListField("m_Data", true);
|
||||
--EditorGUI.indentLevel;
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Large");
|
||||
PropertyField("m_LargeThreshold");
|
||||
PropertyField("m_PlaceHolder");
|
||||
PropertyField("m_MinShowLabel");
|
||||
PropertyField("m_MinShowLabelValue");
|
||||
});
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_HeatmapType");
|
||||
PropertyField("m_Ignore");
|
||||
PropertyField("m_IgnoreValue");
|
||||
PropertyField("m_MaxCache");
|
||||
|
||||
|
||||
PropertyField("m_Symbol");
|
||||
PropertyField("m_ItemStyle");
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace XCharts.Editor
|
||||
PropertyField("m_IgnoreValue");
|
||||
PropertyField("m_ClickOffset");
|
||||
PropertyField("m_RadiusGradient");
|
||||
PropertyField("m_MinShowLabel");
|
||||
PropertyField("m_MinShowLabelValue");
|
||||
});
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
|
||||
24
Editor/Series/SerieDataLinkDrawer.cs
Normal file
24
Editor/Series/SerieDataLinkDrawer.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SerieDataLink), true)]
|
||||
public class SerieDataLinkDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Link"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Source");
|
||||
PropertyField(prop, "m_Target");
|
||||
PropertyField(prop, "m_Value");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Series/SerieDataLinkDrawer.cs.meta
Normal file
11
Editor/Series/SerieDataLinkDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 877ff0f4c473d47f29e7e7e3a3eaf53b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,6 +12,8 @@ namespace XCharts.Editor
|
||||
private bool m_DataFoldout = false;
|
||||
private bool m_DataComponentFoldout = true;
|
||||
private Dictionary<int, bool> m_DataElementFoldout = new Dictionary<int, bool>();
|
||||
private bool m_LinksFoldout = false;
|
||||
private Dictionary<int, bool> m_LinksElementFoldout = new Dictionary<int, bool>();
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
@@ -31,12 +33,16 @@ namespace XCharts.Editor
|
||||
OnCustomInspectorGUI();
|
||||
OnExtraInspectorGUI();
|
||||
PropertyFieldData();
|
||||
OnEndCustomInspectorGUI();
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
public virtual void OnCustomInspectorGUI()
|
||||
{ }
|
||||
|
||||
public virtual void OnEndCustomInspectorGUI()
|
||||
{ }
|
||||
|
||||
private void OnExtraInspectorGUI()
|
||||
{
|
||||
foreach (var kv in Serie.extraComponentMap)
|
||||
@@ -52,7 +58,7 @@ namespace XCharts.Editor
|
||||
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Import ECharts Data", () =>
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null);
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
if (!m_DataFoldout) return;
|
||||
@@ -97,6 +103,48 @@ namespace XCharts.Editor
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
protected void PropertyFieldLinks()
|
||||
{
|
||||
m_LinksFoldout = ChartEditorHelper.DrawHeader("Links", m_LinksFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Import ECharts Link", () =>
|
||||
{
|
||||
//PraseExternalDataEditor.UpdateData(chart, serie, null, true);
|
||||
//PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
if (!m_LinksFoldout) return;
|
||||
EditorGUI.indentLevel++;
|
||||
var m_Links = FindProperty("m_Links");
|
||||
var listSize = m_Links.arraySize;
|
||||
listSize = EditorGUILayout.IntField("Size", listSize);
|
||||
if (listSize < 0) listSize = 0;
|
||||
if (listSize != m_Links.arraySize)
|
||||
{
|
||||
while (listSize > m_Links.arraySize) m_Links.arraySize++;
|
||||
while (listSize < m_Links.arraySize) m_Links.arraySize--;
|
||||
}
|
||||
if (listSize > 30) // && !XCSettings.editorShowAllListData)
|
||||
{
|
||||
int num = listSize > 10 ? 10 : listSize;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
DrawSerieDataLink(m_Links, i);
|
||||
}
|
||||
if (num >= 10)
|
||||
{
|
||||
ChartEditorHelper.DrawHeader("... ", false, false, null, null);
|
||||
DrawSerieDataLink(m_Links, listSize - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_Links.arraySize; i++)
|
||||
{
|
||||
DrawSerieDataLink(m_Links, i);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
protected void PropertyFiledMore(System.Action action)
|
||||
{
|
||||
m_MoreFoldout = ChartEditorHelper.DrawHeader(MORE, m_MoreFoldout, false, null, null);
|
||||
@@ -118,7 +166,7 @@ namespace XCharts.Editor
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var dataIndex = serieData.FindPropertyRelative("m_Index").intValue;
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + dataIndex, flag, false, null,
|
||||
delegate(Rect drawRect)
|
||||
delegate (Rect drawRect)
|
||||
{
|
||||
//drawRect.width -= 2f;
|
||||
var maxX = drawRect.xMax;
|
||||
@@ -242,5 +290,38 @@ namespace XCharts.Editor
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
private void DrawSerieDataLink(SerializedProperty m_Datas, int index)
|
||||
{
|
||||
bool flag;
|
||||
if (!m_LinksElementFoldout.TryGetValue(index, out flag))
|
||||
{
|
||||
flag = false;
|
||||
m_LinksElementFoldout[index] = false;
|
||||
}
|
||||
var dataLink = m_Datas.GetArrayElementAtIndex(index);
|
||||
m_LinksElementFoldout[index] = ChartEditorHelper.DrawHeader("Link " + index, flag, false, null,
|
||||
delegate (Rect drawRect)
|
||||
{
|
||||
var sourceIndex = dataLink.FindPropertyRelative("m_Source");
|
||||
var targetIndex = dataLink.FindPropertyRelative("m_Target");
|
||||
var value = dataLink.FindPropertyRelative("m_Value");
|
||||
ChartEditorHelper.MakeThreeField(ref drawRect, drawRect.width, sourceIndex, targetIndex, value, "");
|
||||
});
|
||||
if (m_LinksElementFoldout[index])
|
||||
{
|
||||
DrawSerieDataLinkDetail(m_Datas, index);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSerieDataLinkDetail(SerializedProperty m_Links, int index)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var dataLink = m_Links.GetArrayElementAtIndex(index);
|
||||
PropertyField(dataLink.FindPropertyRelative("m_Source"));
|
||||
PropertyField(dataLink.FindPropertyRelative("m_Target"));
|
||||
PropertyField(dataLink.FindPropertyRelative("m_Value"));
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,6 +106,23 @@ namespace XCharts.Editor
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
|
||||
public static void MakeThreeField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
|
||||
SerializedProperty prop2, SerializedProperty prop3, string name)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, name);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
|
||||
var diff = 13 + EditorGUI.indentLevel * 14;
|
||||
var offset = diff - INDENT_WIDTH;
|
||||
var tempWidth = (rectWidth - startX + diff) / 3;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
||||
var centerZRect = new Rect(centerYRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
||||
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
|
||||
EditorGUI.PropertyField(centerZRect, prop3, GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
|
||||
public static void MakeVector2(ref Rect drawRect, float rectWidth, SerializedProperty prop, string name)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, name);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace XCharts.Editor
|
||||
private static BaseChart s_Chart;
|
||||
private static Serie s_Serie;
|
||||
private static Axis s_Axis;
|
||||
private static bool s_LinksData;
|
||||
private static PraseExternalDataEditor window;
|
||||
private static string inputJsonText = "";
|
||||
|
||||
@@ -23,11 +24,12 @@ namespace XCharts.Editor
|
||||
window.Show();
|
||||
}
|
||||
|
||||
public static void UpdateData(BaseChart chart, Serie serie, Axis axis)
|
||||
public static void UpdateData(BaseChart chart, Serie serie, Axis axis, bool linksData)
|
||||
{
|
||||
s_Chart = chart;
|
||||
s_Serie = serie;
|
||||
s_Axis = axis;
|
||||
s_LinksData = linksData;
|
||||
inputJsonText = UnityEngine.GUIUtility.systemCopyBuffer;
|
||||
}
|
||||
|
||||
@@ -97,7 +99,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
arrayData = arrayData.Trim();
|
||||
if (!arrayData.StartsWith("data: Array")) return false;
|
||||
serie.ClearData();
|
||||
if (s_LinksData) serie.ClearLinks();
|
||||
else serie.ClearData();
|
||||
var list = arrayData.Split('\n');
|
||||
for (int i = 1; i < list.Length; i++)
|
||||
{
|
||||
@@ -140,7 +143,8 @@ namespace XCharts.Editor
|
||||
private static bool ParseJsonData(Serie serie, string jsonData)
|
||||
{
|
||||
if (!CheckJsonData(ref jsonData)) return false;
|
||||
serie.ClearData();
|
||||
if (s_LinksData) serie.ClearLinks();
|
||||
else serie.ClearData();
|
||||
if (jsonData.IndexOf("],") > -1 || jsonData.IndexOf("] ,") > -1)
|
||||
{
|
||||
string[] datas = jsonData.Split(new string[] { "],", "] ," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
111
Editor/Windows/XChartsEditor.BarChart.cs
Normal file
111
Editor/Windows/XChartsEditor.BarChart.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/BarChart/Baisc Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Baisc Column", priority = 45)]
|
||||
public static void AddBarChart()
|
||||
{
|
||||
AddChart<BarChart>("BarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Zebra Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Zebra Column", priority = 45)]
|
||||
public static void AddBarChart_ZebraColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Zebra Column");
|
||||
chart.DefaultZebraColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Capsule Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Capsule Column", priority = 45)]
|
||||
public static void AddBarChart_CapsuleColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Capsule Column");
|
||||
chart.DefaultCapsuleColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Grouped Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Grouped Column", priority = 45)]
|
||||
public static void AddBarChart_GroupedColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Grouped Column");
|
||||
chart.DefaultGroupedColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Stacked Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Stacked Column", priority = 45)]
|
||||
public static void AddBarChart_StackedColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Stacked Column");
|
||||
chart.DefaultStackedColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Percent Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Percent Column", priority = 45)]
|
||||
public static void AddBarChart_PercentColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Percent Column");
|
||||
chart.DefaultPercentColumnChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Baisc Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Baisc Bar", priority = 45)]
|
||||
public static void AddBarChart_BasicBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart");
|
||||
chart.DefaultBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Zebra Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Zebra Bar", priority = 45)]
|
||||
public static void AddBarChart_ZebraBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Zebra Bar");
|
||||
chart.DefaultZebraBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Capsule Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Capsule Bar", priority = 45)]
|
||||
public static void AddBarChart_CapsuleBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Capsule Bar");
|
||||
chart.DefaultCapsuleBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Grouped Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Grouped Bar", priority = 45)]
|
||||
public static void AddBarChart_GroupedBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Grouped Bar");
|
||||
chart.DefaultGroupedBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Stacked Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Stacked Bar", priority = 45)]
|
||||
public static void AddBarChart_StackedBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Stacked Bar");
|
||||
chart.DefaultStackedBarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Percent Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Percent Bar", priority = 45)]
|
||||
public static void AddBarChart_PercentBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Percent Bar");
|
||||
chart.DefaultPercentBarChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.BarChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.BarChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56ff28653cd1148dc857e65c4440cf74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
95
Editor/Windows/XChartsEditor.LineChart.cs
Normal file
95
Editor/Windows/XChartsEditor.LineChart.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/LineChart/Basic Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Basic Line", priority = 44)]
|
||||
public static void AddLineChart()
|
||||
{
|
||||
AddChart<LineChart>("LineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Area Line", priority = 44)]
|
||||
public static void AddLineChart_Area()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Area", "Area Line");
|
||||
chart.DefaultAreaLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Smooth Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Smooth Line", priority = 44)]
|
||||
public static void AddLineChart_Smooth()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Smooth", "Smooth Line");
|
||||
chart.DefaultSmoothLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Smooth Area", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Smooth Area Line", priority = 44)]
|
||||
public static void AddLineChart_SmoothArea()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_SmoothArea", "Smooth Area Line");
|
||||
chart.DefaultSmoothAreaLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Stack Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Stack Line", priority = 44)]
|
||||
public static void AddLineChart_Stack()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Stack", "Stack Line");
|
||||
chart.DefaultStackLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Stack Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Stack Area Line", priority = 44)]
|
||||
public static void AddLineChart_StackArea()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_StackArea", "Stack Area Line");
|
||||
chart.DefaultStackAreaLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Step Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Step Line", priority = 44)]
|
||||
public static void AddLineChart_Step()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Step", "Step Line");
|
||||
chart.DefaultStepLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Dashed Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Dashed Line", priority = 44)]
|
||||
public static void AddLineChart_Dash()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Dashed", "Dashed Line");
|
||||
chart.DefaultDashLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Time Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Time Line", priority = 44)]
|
||||
public static void AddLineChart_Time()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Time", "Time Line");
|
||||
chart.DefaultTimeLineChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Log Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Log Line", priority = 44)]
|
||||
public static void AddLineChart_Log()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Log", "Log Line");
|
||||
chart.DefaultLogLineChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.LineChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.LineChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5036b2e279753473a906aaaf8b369d44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Editor/Windows/XChartsEditor.PieChart.cs
Normal file
63
Editor/Windows/XChartsEditor.PieChart.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/PieChart/Pie", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Pie", priority = 46)]
|
||||
public static void AddPieChart()
|
||||
{
|
||||
AddChart<PieChart>("PieChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Pie With Label", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Pie With Label", priority = 46)]
|
||||
public static void AddPieChart_WithLabel()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultLabelPieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Donut", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Donut", priority = 46)]
|
||||
public static void AddPieChart_Donut()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultDonutPieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Donut With Label", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Donut With Label", priority = 46)]
|
||||
public static void AddPieChart_DonutWithLabel()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultLabelDonutPieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Radius Rose", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Radius Rose", priority = 46)]
|
||||
public static void AddPieChart_RadiusRose()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultRadiusRosePieChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Area Rose", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Area Rose", priority = 46)]
|
||||
public static void AddPieChart_AreaRose()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
chart.DefaultAreaRosePieChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.PieChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.PieChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75bcae53ea72749418444c00f6281a3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
49
Editor/Windows/XChartsEditor.PolarChart.cs
Normal file
49
Editor/Windows/XChartsEditor.PolarChart.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/PolarChart/Line", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Line", priority = 54)]
|
||||
public static void PolarChart()
|
||||
{
|
||||
AddChart<PolarChart>("PolarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Radial Bar", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Radial Bar", priority = 54)]
|
||||
public static void PolarChart_RadialBar()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
chart.DefaultRadialBarPolarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Tangential Bar", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Tangential Bar", priority = 54)]
|
||||
public static void PolarChart_TangentialBar()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
chart.DefaultTangentialBarPolarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Heatmap", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Heatmap", priority = 54)]
|
||||
public static void PolarChart_Heatmap()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
chart.DefaultHeatmapPolarChart();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
Editor/Windows/XChartsEditor.PolarChart.cs.meta
Normal file
11
Editor/Windows/XChartsEditor.PolarChart.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cf6923e1dcc04bb4a077d53bf7b6a0d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -12,7 +12,7 @@ using ADB = UnityEditor.AssetDatabase;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class XChartsEditor : UnityEditor.Editor
|
||||
public partial class XChartsEditor : UnityEditor.Editor
|
||||
{
|
||||
private static Transform GetParent()
|
||||
{
|
||||
@@ -61,13 +61,19 @@ namespace XCharts.Editor
|
||||
return name;
|
||||
}
|
||||
|
||||
public static T AddChart<T>(string chartName) where T : BaseChart
|
||||
public static T AddChart<T>(string chartName, string titleName = null) where T : BaseChart
|
||||
{
|
||||
XCThemeMgr.CheckReloadTheme();
|
||||
return AddGraph<T>(chartName);
|
||||
var chart = AddGraph<T>(chartName);
|
||||
if (!string.IsNullOrEmpty(titleName))
|
||||
{
|
||||
var title = chart.GetChartComponent<Title>();
|
||||
title.text = titleName;
|
||||
}
|
||||
return chart;
|
||||
}
|
||||
|
||||
public static T AddGraph<T>(string graphName) where T : BaseGraph
|
||||
public static T AddGraph<T>(string graphName) where T : Graphic
|
||||
{
|
||||
var parent = GetParent();
|
||||
if (parent == null) return null;
|
||||
@@ -93,96 +99,99 @@ namespace XCharts.Editor
|
||||
[MenuItem("GameObject/XCharts/EmptyChart", priority = 43)]
|
||||
public static void AddBaseChart()
|
||||
{
|
||||
var chart = AddChart<BaseChart>("EmptyChart");
|
||||
chart.GetChartComponent<Title>().text = "EmptyChart";
|
||||
AddChart<BaseChart>("EmptyChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart", priority = 44)]
|
||||
public static void AddLineChart()
|
||||
{
|
||||
AddChart<LineChart>("LineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart", priority = 45)]
|
||||
public static void AddBarChart()
|
||||
{
|
||||
AddChart<BarChart>("BarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart", priority = 46)]
|
||||
public static void AddPieChart()
|
||||
{
|
||||
AddChart<PieChart>("PieChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RadarChart", priority = 47)]
|
||||
[MenuItem("GameObject/XCharts/RadarChart", priority = 47)]
|
||||
[MenuItem("XCharts/RadarChart/Polygon Radar", priority = 47)]
|
||||
[MenuItem("GameObject/XCharts/RadarChart/Polygon Radar", priority = 47)]
|
||||
public static void AddRadarChart()
|
||||
{
|
||||
AddChart<RadarChart>("RadarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ScatterChart", priority = 48)]
|
||||
[MenuItem("GameObject/XCharts/ScatterChart", priority = 48)]
|
||||
[MenuItem("XCharts/RadarChart/Cirle Radar", priority = 47)]
|
||||
[MenuItem("GameObject/XCharts/RadarChart/Cirle Radar", priority = 47)]
|
||||
public static void AddRadarChart_CirleRadar()
|
||||
{
|
||||
var chart = AddChart<RadarChart>("RadarChart");
|
||||
chart.DefaultCircleRadarChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ScatterChart/Scatter", priority = 48)]
|
||||
[MenuItem("GameObject/XCharts/ScatterChart/Scatter", priority = 48)]
|
||||
public static void AddScatterChart()
|
||||
{
|
||||
AddChart<ScatterChart>("ScatterChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/HeatmapChart", priority = 49)]
|
||||
[MenuItem("GameObject/XCharts/HeatmapChart", priority = 49)]
|
||||
[MenuItem("XCharts/ScatterChart/Bubble", priority = 48)]
|
||||
[MenuItem("GameObject/XCharts/ScatterChart/Bubble", priority = 48)]
|
||||
public static void AddScatterChart_Bubble()
|
||||
{
|
||||
var chart = AddChart<ScatterChart>("ScatterChart");
|
||||
chart.DefaultBubbleChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/HeatmapChart/Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/XCharts/HeatmapChart/Heatmap", priority = 49)]
|
||||
public static void AddHeatmapChart()
|
||||
{
|
||||
AddChart<HeatmapChart>("HeatmapChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RingChart", priority = 51)]
|
||||
[MenuItem("GameObject/XCharts/RingChart", priority = 51)]
|
||||
[MenuItem("XCharts/HeatmapChart/Count Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/XCharts/HeatmapChart/Count Heatmap", priority = 49)]
|
||||
public static void AddHeatmapChart_Count()
|
||||
{
|
||||
var chart = AddChart<HeatmapChart>("HeatmapChart");
|
||||
chart.DefaultCountHeatmapChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RingChart/Ring", priority = 51)]
|
||||
[MenuItem("GameObject/XCharts/RingChart/Ring", priority = 51)]
|
||||
public static void AddRingChart()
|
||||
{
|
||||
AddChart<RingChart>("RingChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/CandlestickChart", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/CandlestickChart", priority = 54)]
|
||||
[MenuItem("XCharts/RingChart/Multiple Ring", priority = 51)]
|
||||
[MenuItem("GameObject/XCharts/RingChart/Multiple Ring", priority = 51)]
|
||||
public static void AddRingChart_MultiRing()
|
||||
{
|
||||
var chart = AddChart<RingChart>("RingChart");
|
||||
chart.DefaultMultipleRingChart();
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/CandlestickChart/Candlestick", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/CandlestickChart/Candlestick", priority = 54)]
|
||||
public static void CandlestickChart()
|
||||
{
|
||||
AddChart<CandlestickChart>("CandlestickChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart", priority = 54)]
|
||||
public static void PolarChart()
|
||||
{
|
||||
AddChart<PolarChart>("PolarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ParallelChart", priority = 55)]
|
||||
[MenuItem("GameObject/XCharts/ParallelChart", priority = 55)]
|
||||
[MenuItem("XCharts/ParallelChart/Parallel", priority = 55)]
|
||||
[MenuItem("GameObject/XCharts/ParallelChart/Parallel", priority = 55)]
|
||||
public static void ParallelChart()
|
||||
{
|
||||
AddChart<ParallelChart>("ParallelChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedLineChart", priority = 56)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedLineChart", priority = 56)]
|
||||
[MenuItem("XCharts/SimplifiedChart/Line", priority = 56)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedChart/Line", priority = 56)]
|
||||
public static void SimplifiedLineChart()
|
||||
{
|
||||
AddChart<SimplifiedLineChart>("SimplifiedLineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedBarChart", priority = 57)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedBarChart", priority = 57)]
|
||||
[MenuItem("XCharts/SimplifiedChart/Bar", priority = 57)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedChart/Bar", priority = 57)]
|
||||
public static void SimplifiedBarChart()
|
||||
{
|
||||
AddChart<SimplifiedBarChart>("SimplifiedBarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedCandlestickChart", priority = 58)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedCandlestickChart", priority = 58)]
|
||||
[MenuItem("XCharts/SimplifiedChart/Candlestick", priority = 58)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedChart/Candlestick", priority = 58)]
|
||||
public static void SimplifiedCandlestickChart()
|
||||
{
|
||||
AddChart<SimplifiedCandlestickChart>("SimplifiedCandlestickChart");
|
||||
|
||||
@@ -47,6 +47,10 @@ namespace XCharts.Example
|
||||
{
|
||||
UpdateData();
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.C))
|
||||
{
|
||||
chart.ClearData();
|
||||
}
|
||||
lastAddTime += Time.deltaTime;
|
||||
if (loopAdd && lastAddTime >= loopAddTime)
|
||||
{
|
||||
@@ -70,10 +74,10 @@ namespace XCharts.Example
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
if (xAxis != null && yAxis != null)
|
||||
{
|
||||
chart.AddXAxisData((xAxis.data.Count + 1).ToString());
|
||||
chart.AddXAxisData((xAxis.GetAddedDataCount() + 1).ToString());
|
||||
for (int i = 0; i < yAxis.data.Count; i++)
|
||||
{
|
||||
chart.AddData(0, xAxis.data.Count - 1, i, Random.Range(10, 90));
|
||||
chart.AddData(0, xAxis.GetAddedDataCount() - 1, i, Random.Range(10, 90));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -85,7 +89,7 @@ namespace XCharts.Example
|
||||
{
|
||||
if (xAxis.type == Axis.AxisType.Category)
|
||||
{
|
||||
chart.AddXAxisData("x" + (xAxis.data.Count + 1));
|
||||
chart.AddXAxisData("x" + (xAxis.GetAddedDataCount() + 1));
|
||||
}
|
||||
}
|
||||
foreach (var serie in chart.series)
|
||||
@@ -143,7 +147,7 @@ namespace XCharts.Example
|
||||
var yAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
for (int i = 0; i < yAxis.data.Count; i++)
|
||||
{
|
||||
chart.AddData(serie.index, xAxis.data.Count - 1, i, Random.Range(0, 150));
|
||||
chart.AddData(serie.index, xAxis.GetAddedDataCount() - 1, i, Random.Range(0, 150));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -65,17 +65,17 @@ namespace XCharts.Example
|
||||
|
||||
void OnSerieClick(SerieEventData data)
|
||||
{
|
||||
Debug.Log("OnSerieClick: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension);
|
||||
Debug.Log("OnSerieClick: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
|
||||
}
|
||||
|
||||
void OnSerieEnter(SerieEventData data)
|
||||
{
|
||||
Debug.Log("OnSerieEnter: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension);
|
||||
Debug.Log("OnSerieEnter: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
|
||||
}
|
||||
|
||||
void OnSerieExit(SerieEventData data)
|
||||
{
|
||||
Debug.Log("OnSerieExit: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension);
|
||||
Debug.Log("OnSerieExit: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension + " " + data.value);
|
||||
}
|
||||
|
||||
void OnDraw(VertexHelper vh)
|
||||
@@ -93,7 +93,7 @@ namespace XCharts.Example
|
||||
//Debug.Log("OnDrawAfterSerie: " + serie.index);
|
||||
if (serie.index != 0) return;
|
||||
var dataPoints = serie.context.dataPoints;
|
||||
if (dataPoints.Count > 0)
|
||||
if (dataPoints.Count > 4)
|
||||
{
|
||||
var pos = dataPoints[3];
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<BarChart>();
|
||||
chart.Init();
|
||||
}
|
||||
var serie = chart.GetSerie(0);
|
||||
serie.animation.enable = true;
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace XCharts.Example
|
||||
{
|
||||
var chartObject = CreateChartObject(chartName);
|
||||
var chart = chartObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
@@ -64,7 +63,6 @@ namespace XCharts.Example
|
||||
{
|
||||
var chartObject = CreateChartObject(chartName);
|
||||
var chart = chartObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
|
||||
@@ -40,7 +40,10 @@ namespace XCharts.Example
|
||||
IEnumerator AddSimpleLine()
|
||||
{
|
||||
chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<LineChart>();
|
||||
if (chart == null){
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.GetChartComponent<Title>().text = "LineChart - 折线图";
|
||||
chart.GetChartComponent<Title>().subText = "普通折线图";
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = "Sin Curve";
|
||||
|
||||
@@ -25,12 +25,11 @@ namespace XCharts.Example
|
||||
|
||||
void AddData()
|
||||
{
|
||||
var chart = gameObject.GetComponent<SimplifiedLineChart>();
|
||||
var chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<SimplifiedLineChart>();
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
chart.Init();
|
||||
chart.SetSize(580, 300);
|
||||
}
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = "Line Simple";
|
||||
@@ -49,9 +48,9 @@ namespace XCharts.Example
|
||||
xAxis.boundaryGap = true;
|
||||
|
||||
chart.RemoveData();
|
||||
chart.AddSerie<SimplifiedLine>();
|
||||
chart.AddSerie<SimplifiedLine>();
|
||||
for (int i = 0; i < 200; i++)
|
||||
chart.AddSerie<Line>();
|
||||
chart.AddSerie<Line>();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
chart.AddXAxisData("x" + i);
|
||||
chart.AddData(0, Random.Range(10, 20));
|
||||
|
||||
@@ -38,7 +38,11 @@ namespace XCharts.Example
|
||||
IEnumerator AddSimpleBar()
|
||||
{
|
||||
chart = gameObject.GetComponent<BarChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<BarChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<BarChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.EnsureChartComponent<Title>().text = "BarChart - 柱状图";
|
||||
chart.EnsureChartComponent<Title>().subText = "普通柱状图";
|
||||
|
||||
|
||||
@@ -38,7 +38,11 @@ namespace XCharts.Example
|
||||
IEnumerator PieAdd()
|
||||
{
|
||||
chart = gameObject.GetComponent<PieChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<PieChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
}
|
||||
yield return null;
|
||||
chart.GetChartComponent<Title>().text = "PieChart - 饼图";
|
||||
chart.GetChartComponent<Title>().subText = "基础饼图";
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<PieChart>();
|
||||
chart.Init();
|
||||
}
|
||||
var serieIndex = 0;
|
||||
var serie = chart.GetSerie(serieIndex);
|
||||
|
||||
@@ -40,7 +40,11 @@ namespace XCharts.Example
|
||||
IEnumerator RadarAdd()
|
||||
{
|
||||
chart = gameObject.GetComponent<RadarChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<RadarChart>();
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<RadarChart>();
|
||||
chart.Init();
|
||||
}
|
||||
|
||||
chart.RemoveChartComponents<RadarCoord>();
|
||||
chart.RemoveData();
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<RadarChart>();
|
||||
chart.Init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<HeatmapChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.GetChartComponent<Title>().text = "HeatmapChart";
|
||||
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.None;
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<BaseChart>();
|
||||
chart.Init();
|
||||
}
|
||||
chart.EnsureChartComponent<PolarCoord>();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace XCharts.Example
|
||||
if (chart == null)
|
||||
{
|
||||
chart = gameObject.AddComponent<CandlestickChart>();
|
||||
chart.Init();
|
||||
}
|
||||
AddData();
|
||||
}
|
||||
|
||||
@@ -23,11 +23,19 @@ namespace XCharts.Example
|
||||
{
|
||||
AddData();
|
||||
}
|
||||
else if(Input.GetKeyDown(KeyCode.R))
|
||||
else if (Input.GetKeyDown(KeyCode.R))
|
||||
{
|
||||
chart.AnimationReset();
|
||||
chart.AnimationFadeIn();
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.U))
|
||||
{
|
||||
chart.UpdateData(0, 2, 99);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.C))
|
||||
{
|
||||
chart.UpdateData(0, 2, 22);
|
||||
}
|
||||
}
|
||||
|
||||
void AddData()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 - 2022 monitor1394
|
||||
Copyright (c) 2018-present, monitor1394
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -96,7 +96,7 @@ A powerful and easy-to-use data visualization library for Unity. It supports mo
|
||||
* Import `XCharts` unitypackage or source code into the project.
|
||||
* Right-click `Hierarchy` view and choose `XCharts->LineChart` to create a default LineChart.
|
||||
* You can adjust the parameters of each component in `Inspector` and see the real-time effects in `Game` view.
|
||||
* For more details, see [[XCharts Tutorial: 5-minute tutorial]](Documentation~/zh/tutorial01.md)
|
||||
* For more details, see [[XCharts Tutorial: 5-minute tutorial]](Documentation~/en/tutorial01.md)
|
||||
* For the first time, it is recommended to read the tutorial carefully.
|
||||
|
||||
## Branch
|
||||
@@ -120,7 +120,7 @@ A: Support code to dynamically add and modify data, but data needs to be parsed
|
||||
A: It is currently only supported on Unity. Theoretically any version of Unity that supports `UGUI` can run `XCharts`.
|
||||
|
||||
* What about the jags? What magnitude of data is supported?
|
||||
A: XCharts is based on UGUI implementation, so the problems encountered in UGUI will also exist in XCharts. For example, the sawtooth problem, such as the number of vertices in `Mesh` exceeds `65535`. Solutions to these two problems can be found in [Q&A 16](Documentation~/zh/faq.md) and [Q&A 27](Documentation~/zh/faq.md).
|
||||
A: XCharts is based on UGUI implementation, so the problems encountered in UGUI will also exist in XCharts. For example, the sawtooth problem, such as the number of vertices in `Mesh` exceeds `65535`. Solutions to these two problems can be found in [Q&A 16](Documentation~/en/faq.md) and [Q&A 27](Documentation~/en/faq.md).
|
||||
Due to the `Mesh` of the `65535` vertex limit, the current `XCharts` single `Line` supports about `20,000` of data, of course, open sampling can support more data to draw, but at the same time it will consume more CPU.
|
||||
|
||||
## Changelog
|
||||
|
||||
97
README.md
97
README.md
@@ -45,38 +45,38 @@
|
||||
|
||||

|
||||
|
||||
一款基于`UGUI`的功能强大、简单易用的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十多种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`等扩展图表。
|
||||
一款基于`UGUI`的功能强大、简单易用的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十多种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`、`桑基图`等多种扩展图表。
|
||||
|
||||
[XCharts 官方主页](https://xcharts-team.github.io)
|
||||
[XCharts 在线示例](https://xcharts-team.github.io/examples)
|
||||
|
||||
[XCharts 教程:5分钟上手 XCharts](Documentation~/zh/tutorial01.md)
|
||||
[XCharts API文档](Documentation~/zh/api.md)
|
||||
[XCharts 问答](Documentation~/zh/faq.md)
|
||||
[XCharts 常见问题](Documentation~/zh/faq.md)
|
||||
[XCharts 配置项手册](Documentation~/zh/configuration.md)
|
||||
[XCharts 更新日志](Documentation~/zh/changelog.md)
|
||||
[XCharts 订阅服务](Documentation~/zh/support.md)
|
||||
|
||||
## 特性
|
||||
|
||||
- __纯代码绘制__:图表完全纯代码绘制,无需额外的贴图和Shader资源。
|
||||
- __可视化配置__:参数可视化配置,效果实时预览,也支持运行时代码动态修改配置和数据。
|
||||
- __纯代码绘制__:图表纯代码绘制,无需额外的贴图和Shader资源。
|
||||
- __可视化配置__:参数可视化配置,效果实时预览,支持运行时代码动态修改配置和数据。
|
||||
- __高自由定制__:支持从主题和配置参数上任意调整;支持代码自定义绘制,自定义回调以及自定义实现图表。
|
||||
- __多内置图表__:支持线图、状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等多种内置图表。
|
||||
- __多扩展图表__:支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图等多种扩展图表。
|
||||
- __多扩展功能__:支持表格、统计数值等扩展UI组件。
|
||||
- __多内置图表__:支持线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等多种内置图表。
|
||||
- __多扩展图表__:支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图、桑基图等多种扩展图表。
|
||||
- __多扩展组件__:支持表格、统计数值等多种扩展UI组件。
|
||||
- __多图表组合__:支持内置图表的任意组合,同一图中可同时显示多个相同或不同类型的图表。
|
||||
- __多种坐标系__:支持直角坐标系、极坐标系、单轴等多种坐标系。
|
||||
- __丰富的组件__:支持标题、图例、提示框、标线、标域、数据区域缩放、视觉映射等常用组件。
|
||||
- __丰富的线图__:支持直线图、曲线图、虚线图、面积图、阶梯线图等多种线图。
|
||||
- __丰富的柱图__:支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图、胶囊柱图等多种柱状图。
|
||||
- __丰富的饼图__:支持环形图、玫瑰图、环形玫瑰图等多种饼图。
|
||||
- __多样式线图__:支持直线图、曲线图、虚线图、面积图、阶梯线图等多种线图。
|
||||
- __多样式柱图__:支持并列柱图、堆叠柱图、堆积百分比柱图、斑马柱图、胶囊柱图等多种柱状图。
|
||||
- __多样式饼图__:支持环形图、玫瑰图、环形玫瑰图等多种饼图。
|
||||
- __丰富的线条__:支持实线、曲线、阶梯线、虚线、点线、点划线、双点划线等线条。
|
||||
- __自定义绘制__:支持自定义图表内容绘制,提供绘制点、线、面等其他图形的强大的绘图API。
|
||||
- __大数据绘制__:支持万级大数据量绘制;支持采样绘制;特殊的简化图表支持更优的性能。
|
||||
- __自定义主题__:支持主题定制、导入和导出,内置明暗两种默认主题。
|
||||
- __动画和交互__:支持渐入动画、渐出动画、变更动画、新增动画、交互动画等多种动画;支持多平台的数据筛选、视图缩放、细节展示等交互操作。
|
||||
- __第三方扩展__:支持接入`TexMeshPro`和`New Input System`。
|
||||
- __第三方扩展__:支持无缝接入`TexMeshPro`和`New Input System`。
|
||||
- __版本和兼容__:支持所有`5.6`以上的`Unity`版本;支持全平台运行。
|
||||
|
||||
## 截图
|
||||
@@ -85,30 +85,54 @@
|
||||
|
||||

|
||||
|
||||
## 仓库
|
||||
|
||||
| 相关仓库 | 仓库介绍 |
|
||||
| -- | --|
|
||||
| [XCharts](https://github.com/XCharts-Team/XCharts) | XCharts核心功能,完全免费。 |
|
||||
| [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon) | XCharts的守护程序,用于确保XCharts更新时的编译正常。非必须,但建议使用。 |
|
||||
| [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) | XCharts的官方示例,不包含扩展图表部分。订阅VIP的用户购买扩展图表后,可加入对应图表的示例。 |
|
||||
| [XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro) | XCharts完全版,包含所有扩展图表和扩展组件。订阅SVIP后可访问使用。 |
|
||||
| [XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) | XCharts完全版官方示例,包含所有扩展图表和扩展组件的示例。订阅SVIP后可访问使用。 |
|
||||
| [XCharts-UI](https://github.com/XCharts-Team/XCharts-UI) | XCharts的扩展UI组件。订阅VIP后可访问使用。 |
|
||||
| [XCharts-Bar3DChart](https://github.com/XCharts-Team/XCharts-Bar3DChart) | XCharts扩展图表:3D柱图。订阅购买后可访问使用。 |
|
||||
| [XCharts-FunnelChart](https://github.com/XCharts-Team/XCharts-FunnelChart) | XCharts扩展图表:漏斗图。订阅购买后可访问使用。 |
|
||||
| [XCharts-GanttChart](https://github.com/XCharts-Team/XCharts-GanttChart) | XCharts扩展图表:甘特图。订阅购买后可访问使用。 |
|
||||
| [XCharts-GaugeChart](https://github.com/XCharts-Team/XCharts-GaugeChart) | XCharts扩展图表:仪表盘。订阅购买后可访问使用。 |
|
||||
| [XCharts-LiquidChart](https://github.com/XCharts-Team/XCharts-LiquidChart) | XCharts扩展图表:水位图。订阅购买后可访问使用。 |
|
||||
| [XCharts-PictorialBarChart](https://github.com/XCharts-Team/XCharts-PictorialBarChart) | XCharts扩展图表:象形住图。订阅购买后可访问使用。 |
|
||||
| [XCharts-Pie3DChart](https://github.com/XCharts-Team/XCharts-Pie3DChart) | XCharts扩展图表:3D饼图。订阅购买后可访问使用。 |
|
||||
| [XCharts-PyramidChart](https://github.com/XCharts-Team/XCharts-PyramidChart) | XCharts扩展图表:3D金字塔。订阅购买后可访问使用。 |
|
||||
| [XCharts-TreemapChart](https://github.com/XCharts-Team/XCharts-TreemapChart) | XCharts扩展图表:矩形树图。订阅购买后可访问使用。 |
|
||||
| [XCharts-SankeyChart](https://github.com/XCharts-Team/XCharts-SankeyChart) | XCharts扩展图表:桑基图。订阅购买后可访问使用。 |
|
||||
|
||||
## 分支
|
||||
|
||||
| 分支 | 分支介绍 |
|
||||
|--|--|
|
||||
| [master](https://github.com/XCharts-Team/XCharts/tree/master) | XCharts3.0的开发分支。最新的修改和功能都先提交到`master`分支,稳定后后再从`master`分支`merge`到`3.0`分支,并发布`release`版本。|
|
||||
| [3.0](https://github.com/XCharts-Team/XCharts/tree/3.0) | XCharts3.0的稳定分支。一般一个月一发布,`master`分支稳定后,`merge`到`3.0`分支,并发布`release`版本。|
|
||||
| [2.0](https://github.com/XCharts-Team/XCharts/tree/2.0) | XCharts2.0的稳定分支。带Demo,目前基本不再维护,仅修改严重bug。|
|
||||
| [2.0-upm](https://github.com/XCharts-Team/XCharts/tree/2.0-upm) | XCharts2.0的稳定UMP分支。不带Demo,只包含Package部分,不再维护。|
|
||||
| [1.0](https://github.com/XCharts-Team/XCharts/tree/1.0) | XCharts1.0的稳定分支。带Demo,不再维护。|
|
||||
| [1.0-upm](https://github.com/XCharts-Team/XCharts/tree/1.0-upm) | XCharts1.0的稳定UMP分支。不带Demo,不再维护。|
|
||||
|
||||
## 注意
|
||||
|
||||
- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,升级`3.0`可能需要调整部分代码,图表部分配置需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。
|
||||
- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,升级`3.0`时,部分代码和配置可能需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。
|
||||
- `XCharts2.0` 进入维护阶段,后续只修复严重`bug`,原则上不再加新功能。
|
||||
- `XCharts` 理论上支持`Unity 5.6`及以上版本,但由于版本测试有限难免疏漏,发现版本兼容问题可提`Issue`。
|
||||
- `XCharts` 理论上支持`Unity 5.6`及以上版本,但由于版本测试有限难免疏漏,发现问题可提`Issue`。
|
||||
- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`示例源码请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。也可以在浏览器查看`WebGL`下的运行效果 [在线Demo](https://xcharts-team.github.io/examples/) 。
|
||||
|
||||
## 使用
|
||||
|
||||
- 导入`XCharts`的`unitypackage`或者源码到项目。
|
||||
- 导入`XCharts`的`unitypackage`或者源码到项目。建议也导入`XCharts`守护程序 [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)。
|
||||
- 在`Hierarchy`视图下右键选择`XCharts->LineChart`,即可创建一个默认的折线图。
|
||||
- 在`Inspector`视图可以调整各个组件的参数,`Game`视图可看到实时效果。
|
||||
- 更多细节,请看[【XCharts教程:5分钟上手教程】](Documentation~/zh/tutorial01.md)
|
||||
- 用`Inspector`视图下的`Add Serie`和`Add Main Component`按钮可以添加`Serie`和`组件`。
|
||||
- 在`Inspector`视图下可以调整各个组件的参数,`Game`视图可看到实时效果。
|
||||
- 更多细节,请看[【XCharts教程:5分钟上手教程】](Documentation~/zh/tutorial01.md)。
|
||||
- 首次使用,建议先认真看一遍教程。
|
||||
|
||||
## 分支
|
||||
|
||||
- `master`:开发分支。最新的修改和新功能都先提交到`master`分支,一段时间后再从`master`分支`merge`到`3.0`分支,并发布`release`版本。
|
||||
- `3.0`:XCharts 3.0的稳定分支。一般一个月一更新,从`master`分支`merge`最新改动过来,并发布`release`版本。
|
||||
- `2.0`:XCharts 2.0的稳定分支。带Demo,目前基本不再维护,仅修改严重bug。
|
||||
- `2.0-upm`:XCharts 2.0的稳定UMP分支。不带Demo,只包含Package部分,专门给UMP用,不再维护。
|
||||
- `1.0`:XCharts 1.0的稳定分支。带Demo,不再维护。
|
||||
- `1.0-upm`:XCharts 1.0的稳定UMP分支。不带Demo,不再维护。
|
||||
|
||||
## FAQ
|
||||
|
||||
- `XCharts`可以免费使用吗?
|
||||
@@ -124,26 +148,25 @@
|
||||
答:`XCharts`是基于`UGUI`实现的,所以`UGUI`中碰到的问题,在`XCharts`中也会存在。比如锯齿问题,比如`Mesh`顶点数超`65535`的问题。这两个问题的解决可参考[问答16](Documentation~/zh/faq.md)和[问答27](Documentation~/zh/faq.md)。
|
||||
由于`Mesh`的`65535`顶点数的限制,目前`XCharts`的单条`Line`支持约`2万`的数据量,当然开启采样可以支持更多数据的绘制,但同时也会更消耗CPU。
|
||||
|
||||
## Licenses
|
||||
|
||||
- [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md)
|
||||
- 可免费商用,可二次开发
|
||||
- 扩展图表和高级功能部分需单独购买授权
|
||||
|
||||
## 日志
|
||||
|
||||
- [更新日志](Documentation~/zh/changelog.md)
|
||||
|
||||
## Licenses
|
||||
|
||||
- [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md)
|
||||
- 可免费商用,可二次开发。
|
||||
- 扩展图表和高级功能部分需购买使用授权。
|
||||
|
||||
## 订阅
|
||||
|
||||
- `XCharts`核心库是开源的,可免费使用的。在此基础上,我们也提供多种订阅服务以满足不同用户的需求,订阅详情[☞ 请看这里](Documentation~/zh/support.md)
|
||||
- 订阅不是必须的,不影响`XCharts`的常用功能使用。
|
||||
- 订阅是按年付费制,部分订阅服务的首年费用比次年要高,是因为包含了购买部分源码。次年的费用基本都是服务费。
|
||||
- 订阅到期后,不要求必须续订,但中断订阅期间无法享受技术支持等服务。如需继续服务,可从当日继续续订即可。
|
||||
- `XCharts`核心库是开源的,可免费使用的。在此基础上,我们也提供多种订阅服务以满足不同用户的需求,订阅详情[☞ 请看这里](Documentation~/zh/support.md)。
|
||||
- 订阅不是必须的,不影响`XCharts`的核心功能使用。
|
||||
- 订阅是按年付费,订阅到期后,不要求必须续订,但中断订阅期间无法享受技术更新和支持等服务。
|
||||
|
||||
## 其他
|
||||
|
||||
- 邮箱:`monitor1394@gmail.com`
|
||||
- QQ群:XCharts交流群(`202030963`)
|
||||
- VIP群:XCharts技术支持VIP群(`867291970`)
|
||||
- 捐助、合作、订阅和技术支持:[☞ 看这里](Documentation~/zh/support.md)
|
||||
- VIP群:XCharts VIP群(`867291970`)
|
||||
- 捐助、合作、订阅和技术支持:[☞ 请看这里](Documentation~/zh/support.md)
|
||||
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Bar chart shows different data through the height of a bar, which is used in rectangular coordinate with at least 1 category axis.
|
||||
/// || 柱状图(或称条形图)是一种通过柱形的高度(横向的情况下则是宽度)来表现数据大小的一种常用图表类型。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/BarChart", 14)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -22,5 +26,153 @@ namespace XCharts.Runtime
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default zebra column chart.
|
||||
/// || 斑马柱状图。
|
||||
/// </summary>
|
||||
public void DefaultZebraColumnChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
if (serie == null) return;
|
||||
serie.barType = BarType.Zebra;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default capsule column chart.
|
||||
/// || 胶囊柱状图。
|
||||
/// </summary>
|
||||
public void DefaultCapsuleColumnChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
if (serie == null) return;
|
||||
serie.barType = BarType.Capsule;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default grouped column chart.
|
||||
/// || 默认分组柱状图。
|
||||
/// </summary>
|
||||
public void DefaultGroupedColumnChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default stacked column chart.
|
||||
/// || 默认堆叠分组柱状图。
|
||||
/// </summary>
|
||||
public void DefaultStackedColumnChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie1 = GetSerie(0);
|
||||
serie1.stack = "stack1";
|
||||
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
serie2.stack = "stack1";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default percent column chart.
|
||||
/// || 默认百分比柱状图。
|
||||
/// </summary>
|
||||
public void DefaultPercentColumnChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie1 = GetSerie(0);
|
||||
serie1.stack = "stack1";
|
||||
serie1.barPercentStack = true;
|
||||
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
serie2.stack = "stack1";
|
||||
serie2.barPercentStack = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default bar chart.
|
||||
/// || 默认条形图。
|
||||
/// </summary>
|
||||
public void DefaultBarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
CovertColumnToBar(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default zebra bar chart.
|
||||
/// || 默认斑马条形图。
|
||||
/// </summary>
|
||||
public void DefaultZebraBarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.barType = BarType.Zebra;
|
||||
CovertColumnToBar(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default capsule bar chart.
|
||||
/// || 默认胶囊条形图。
|
||||
/// </summary>
|
||||
public void DefaultCapsuleBarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.barType = BarType.Capsule;
|
||||
CovertColumnToBar(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default grouped bar chart.
|
||||
/// || 默认分组条形图。
|
||||
/// </summary>
|
||||
public void DefaultGroupedBarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
CovertColumnToBar(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default stacked bar chart.
|
||||
/// || 默认堆叠条形图。
|
||||
/// </summary>
|
||||
public void DefaultStackedBarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie1 = GetSerie(0);
|
||||
serie1.stack = "stack1";
|
||||
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
serie2.stack = "stack1";
|
||||
CovertColumnToBar(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default percent bar chart.
|
||||
/// || 默认百分比条形图。
|
||||
/// </summary>
|
||||
public void DefaultPercentBarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie1 = GetSerie(0);
|
||||
serie1.stack = "stack1";
|
||||
serie1.barPercentStack = true;
|
||||
var serie2 = Bar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
serie2.stack = "stack1";
|
||||
serie2.barPercentStack = true;
|
||||
CovertColumnToBar(this);
|
||||
}
|
||||
|
||||
private static void CovertColumnToBar(BarChart chart)
|
||||
{
|
||||
chart.ConvertXYAxis(0);
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
xAxis.axisLine.show = false;
|
||||
xAxis.axisTick.show = false;
|
||||
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
yAxis.axisTick.alignWithLabel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// A candlestick chart is a style of financial chart used to describe price movements of a security, derivative, or currency.
|
||||
/// || 蜡烛图,也叫K线图,用于描述证券、衍生品或货币的价格走势的一种金融图表样式。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/CandlestickChart", 23)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
|
||||
@@ -3,6 +3,12 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Heat map mainly use colors to represent values, which must be used along with visualMap component.
|
||||
/// It can be used in either rectangular coordinate or geographic coordinate. But the behaviour on them are quite different. Rectangular coordinate must have two categories to use it.
|
||||
/// ||热力图主要通过颜色去表现数值的大小,必须要配合 visualMap 组件使用。
|
||||
/// 可以应用在直角坐标系以及地理坐标系上,这两个坐标系上的表现形式相差很大,直角坐标系上必须要使用两个类目轴。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/HeatmapChart", 18)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -13,23 +19,26 @@ namespace XCharts.Runtime
|
||||
protected override void DefaultChart()
|
||||
{
|
||||
var grid = EnsureChartComponent<GridCoord>();
|
||||
grid.UpdateRuntimeData(this);
|
||||
grid.left = 0.12f;
|
||||
|
||||
var heatmapGridWid = 18f;
|
||||
int xSplitNumber = (int)(grid.context.width / heatmapGridWid);
|
||||
int ySplitNumber = (int)(grid.context.height / heatmapGridWid);
|
||||
|
||||
var xAxis = EnsureChartComponent<XAxis>();
|
||||
xAxis.type = Axis.AxisType.Category;
|
||||
xAxis.splitLine.show = false;
|
||||
xAxis.boundaryGap = true;
|
||||
xAxis.splitNumber = 10;
|
||||
xAxis.splitNumber = xSplitNumber / 2;
|
||||
|
||||
var yAxis = EnsureChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Category;
|
||||
yAxis.splitLine.show = false;
|
||||
yAxis.boundaryGap = true;
|
||||
yAxis.splitNumber = 10;
|
||||
yAxis.splitNumber = ySplitNumber;
|
||||
RemoveData();
|
||||
|
||||
var heatmapGridWid = 10f;
|
||||
int xSplitNumber = (int) (grid.context.width / heatmapGridWid);
|
||||
int ySplitNumber = (int) (grid.context.height / heatmapGridWid);
|
||||
|
||||
Heatmap.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
|
||||
var visualMap = EnsureChartComponent<VisualMap>();
|
||||
@@ -72,5 +81,32 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default count heatmap chart.
|
||||
/// || 默认计数热力图。
|
||||
/// </summary>
|
||||
public void DefaultCountHeatmapChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
|
||||
var serie = GetSerie<Heatmap>(0);
|
||||
serie.heatmapType = HeatmapType.Count;
|
||||
var xAxis = GetChartComponent<XAxis>();
|
||||
xAxis.type = Axis.AxisType.Value;
|
||||
xAxis.splitNumber = 4;
|
||||
|
||||
var yAxis = GetChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Value;
|
||||
yAxis.splitNumber = 2;
|
||||
|
||||
serie.ClearData();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
var x = UnityEngine.Random.Range(0, 100);
|
||||
var y = UnityEngine.Random.Range(0, 100);
|
||||
AddData(0, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,12 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Line chart relates all the data points symbol by broken lines, which is used to show the trend of data changing.
|
||||
/// It could be used in both rectangular coordinate andpolar coordinate.
|
||||
/// ||折线图是用折线将各个数据点标志连接起来的图表,用于展现数据的变化趋势。可用于直角坐标系和极坐标系上。
|
||||
/// 设置 areaStyle 后可以绘制面积图。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/LineChart", 13)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -22,5 +28,119 @@ namespace XCharts.Runtime
|
||||
AddXAxisData("x" + (i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default area line chart.
|
||||
/// || 默认面积折线图。
|
||||
/// </summary>
|
||||
public void DefaultAreaLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
if (serie == null) return;
|
||||
serie.EnsureComponent<AreaStyle>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default smooth line chart.
|
||||
/// || 默认平滑折线图。
|
||||
/// </summary>
|
||||
public void DefaultSmoothLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
if (serie == null) return;
|
||||
serie.lineType = LineType.Smooth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default smooth area line chart.
|
||||
/// || 默认平滑面积折线图。
|
||||
/// </summary>
|
||||
public void DefaultSmoothAreaLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
if (serie == null) return;
|
||||
serie.EnsureComponent<AreaStyle>();
|
||||
serie.lineType = LineType.Smooth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default stack line chart.
|
||||
/// || 默认堆叠折线图。
|
||||
/// </summary>
|
||||
public void DefaultStackLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie1 = GetSerie(0);
|
||||
if (serie1 == null) return;
|
||||
serie1.stack = "stack1";
|
||||
var serie2 = Line.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
serie2.stack = "stack1";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default stack area line chart.
|
||||
/// || 默认堆叠面积折线图。
|
||||
/// </summary>
|
||||
public void DefaultStackAreaLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie1 = GetSerie(0);
|
||||
if (serie1 == null) return;
|
||||
serie1.EnsureComponent<AreaStyle>();
|
||||
serie1.stack = "stack1";
|
||||
var serie2 = Line.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
serie2.EnsureComponent<AreaStyle>();
|
||||
serie2.stack = "stack1";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default step line chart.
|
||||
/// || 默认阶梯折线图。
|
||||
/// </summary>
|
||||
public void DefaultStepLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
if (serie == null) return;
|
||||
serie.lineType = LineType.StepMiddle;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default dash line chart.
|
||||
/// || 默认虚线折线图。
|
||||
/// </summary>
|
||||
public void DefaultDashLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
if (serie == null) return;
|
||||
serie.lineType = LineType.Normal;
|
||||
serie.lineStyle.type = LineStyle.Type.Dashed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default time line chart.
|
||||
/// || 默认时间折线图。
|
||||
/// </summary>
|
||||
public void DefaultTimeLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var xAxis = GetChartComponent<XAxis>();
|
||||
xAxis.type = Axis.AxisType.Time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default logarithmic line chart.
|
||||
/// || 默认对数轴折线图。
|
||||
/// </summary>
|
||||
public void DefaultLogLineChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var yAxis = GetChartComponent<YAxis>();
|
||||
yAxis.type = Axis.AxisType.Log;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Parallel Coordinates is a common way of visualizing high-dimensional geometry and analyzing multivariate data.
|
||||
/// || 平行坐标系,通过绘制垂直于坐标轴的平行线来显示数据的一种可视化图表。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/ParallelChart", 25)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The pie chart is mainly used for showing proportion of different categories. Each arc length represents the proportion of data quantity.
|
||||
/// || 饼图主要用于显示不同类目占比的情况,通过弧长来反映数据的大小占比。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/PieChart", 15)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -17,5 +21,69 @@ namespace XCharts.Runtime
|
||||
RemoveData();
|
||||
Pie.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default label pie chart.
|
||||
/// || 默认带标签饼图。
|
||||
/// </summary>
|
||||
public void DefaultLabelPieChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
serie.EnsureComponent<LabelLine>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default donut pie chart.
|
||||
/// || 默认甜甜圈饼图。
|
||||
/// </summary>
|
||||
public void DefaultDonutPieChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.radius[0] = 0.20f;
|
||||
serie.radius[1] = 0.28f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default label donut pie chart.
|
||||
/// || 默认带标签甜甜圈饼图。
|
||||
/// </summary>
|
||||
public void DefaultLabelDonutPieChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.radius[0] = 0.20f;
|
||||
serie.radius[1] = 0.28f;
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
serie.EnsureComponent<LabelLine>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default rose pie chart.
|
||||
/// || 默认玫瑰饼图。
|
||||
/// </summary>
|
||||
public void DefaultRadiusRosePieChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.pieRoseType = RoseType.Radius;
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
serie.EnsureComponent<LabelLine>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default area rose pie chart.
|
||||
/// || 默认面积玫瑰饼图。
|
||||
/// </summary>
|
||||
public void DefaultAreaRosePieChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.pieRoseType = RoseType.Area;
|
||||
serie.EnsureComponent<LabelStyle>();
|
||||
serie.EnsureComponent<LabelLine>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Polar coordinates are usually used in a circular layout.
|
||||
/// || 极坐标系,可以用于散点图和折线图。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/PolarChart", 23)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -13,7 +18,8 @@ namespace XCharts.Runtime
|
||||
{
|
||||
EnsureChartComponent<PolarCoord>();
|
||||
EnsureChartComponent<AngleAxis>();
|
||||
EnsureChartComponent<RadiusAxis>();
|
||||
var radiusAxis = EnsureChartComponent<RadiusAxis>();
|
||||
radiusAxis.axisLabel.show = false;
|
||||
|
||||
var tooltip = EnsureChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.Corss;
|
||||
@@ -23,6 +29,7 @@ namespace XCharts.Runtime
|
||||
var serie = Line.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
serie.SetCoord<PolarCoord>();
|
||||
serie.ClearData();
|
||||
serie.symbol.show = false;
|
||||
for (int i = 0; i <= 360; i++)
|
||||
{
|
||||
var t = i / 180f * Mathf.PI;
|
||||
@@ -30,5 +37,132 @@ namespace XCharts.Runtime
|
||||
AddData(0, Mathf.Abs(r), i);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default radial bar polar chart.
|
||||
/// || 默认径向柱状极坐标图。
|
||||
/// </summary>
|
||||
public void DefaultRadialBarPolarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
RemoveData();
|
||||
|
||||
var polarCoord = GetChartComponent<PolarCoord>();
|
||||
polarCoord.radius[0] = 20;
|
||||
|
||||
var categorys = new string[] { "a", "b", "c", "d" };
|
||||
var radiusAxis = GetChartComponent<RadiusAxis>();
|
||||
radiusAxis.splitNumber = 4;
|
||||
|
||||
var angleAxis = GetChartComponent<AngleAxis>();
|
||||
angleAxis.type = Axis.AxisType.Category;
|
||||
angleAxis.startAngle = 75;
|
||||
angleAxis.boundaryGap = true;
|
||||
angleAxis.splitLine.show = false;
|
||||
|
||||
foreach (var category in categorys)
|
||||
angleAxis.AddData(category);
|
||||
|
||||
var serie = AddSerie<Bar>(GenerateDefaultSerieName());
|
||||
serie.SetCoord<PolarCoord>();
|
||||
serie.ClearData();
|
||||
serie.symbol.show = false;
|
||||
for (int i = 0; i < categorys.Length; i++)
|
||||
{
|
||||
var x = UnityEngine.Random.Range(0f, 4f);
|
||||
var y = i;
|
||||
AddData(0, x, y, categorys[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default tangential bar polar chart.
|
||||
/// || 默认切向柱状极坐标图。
|
||||
/// </summary>
|
||||
public void DefaultTangentialBarPolarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
RemoveData();
|
||||
|
||||
var polarCoord = GetChartComponent<PolarCoord>();
|
||||
polarCoord.radius[0] = 20;
|
||||
|
||||
var categorys = new string[] { "a", "b", "c", "d" };
|
||||
var radiusAxis = GetChartComponent<RadiusAxis>();
|
||||
radiusAxis.type = Axis.AxisType.Category;
|
||||
radiusAxis.splitNumber = 4;
|
||||
radiusAxis.boundaryGap = true;
|
||||
|
||||
var angleAxis = GetChartComponent<AngleAxis>();
|
||||
angleAxis.type = Axis.AxisType.Value;
|
||||
radiusAxis.splitNumber = 12;
|
||||
angleAxis.startAngle = 75;
|
||||
angleAxis.max = 4;
|
||||
|
||||
foreach (var category in categorys)
|
||||
radiusAxis.AddData(category);
|
||||
|
||||
var serie = AddSerie<Bar>(GenerateDefaultSerieName());
|
||||
serie.SetCoord<PolarCoord>();
|
||||
serie.ClearData();
|
||||
serie.symbol.show = false;
|
||||
for (int i = 0; i < categorys.Length; i++)
|
||||
{
|
||||
var x = UnityEngine.Random.Range(0f, 4f);
|
||||
var y = i;
|
||||
AddData(0, y, x, categorys[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default heatmap polar chart.
|
||||
/// || 默认极坐标色块图。
|
||||
/// </summary>
|
||||
public void DefaultHeatmapPolarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
RemoveData();
|
||||
|
||||
var visualMap = EnsureChartComponent<VisualMap>();
|
||||
var colors = new List<string> { "#BAE7FF", "#1890FF", "#1028ff" };
|
||||
visualMap.AddColors(colors);
|
||||
visualMap.autoMinMax = true;
|
||||
|
||||
var polarCoord = GetChartComponent<PolarCoord>();
|
||||
polarCoord.radius[0] = 20;
|
||||
|
||||
var categorys = new string[] { "a", "b", "c", "d" };
|
||||
var radiusAxis = GetChartComponent<RadiusAxis>();
|
||||
radiusAxis.type = Axis.AxisType.Category;
|
||||
radiusAxis.splitNumber = 4;
|
||||
radiusAxis.boundaryGap = true;
|
||||
|
||||
var angleAxis = GetChartComponent<AngleAxis>();
|
||||
angleAxis.type = Axis.AxisType.Category;
|
||||
angleAxis.boundaryGap = true;
|
||||
angleAxis.splitNumber = 24;
|
||||
angleAxis.startAngle = 75;
|
||||
angleAxis.max = 4;
|
||||
|
||||
foreach (var category in categorys)
|
||||
radiusAxis.AddData(category);
|
||||
|
||||
for (int i = 0; i < 24; i++)
|
||||
{
|
||||
angleAxis.AddData(i + "h");
|
||||
}
|
||||
|
||||
var serie = AddSerie<Heatmap>(GenerateDefaultSerieName());
|
||||
serie.SetCoord<PolarCoord>();
|
||||
serie.ClearData();
|
||||
serie.symbol.show = false;
|
||||
for (int x = 0; x < 4; x++)
|
||||
{
|
||||
for (int y = 0; y < 24; y++)
|
||||
{
|
||||
AddData(0, x, y, UnityEngine.Random.Range(0f, 4f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Radar chart is mainly used to show multi-variable data, such as the analysis of a football player's varied attributes. It relies radar component.
|
||||
/// || 雷达图主要用于显示多变量的数据,例如足球运动员的各项属性分析。依赖雷达组件。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/RadarChart", 16)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -16,5 +20,16 @@ namespace XCharts.Runtime
|
||||
AddChartComponent<RadarCoord>();
|
||||
Radar.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default circle radar chart.
|
||||
/// || 默认圆形雷达图。
|
||||
/// </summary>
|
||||
public void DefaultCircleRadarChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var radarCoord = GetChartComponent<RadarCoord>();
|
||||
radarCoord.shape = RadarCoord.Shape.Circle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Ring chart is mainly used to show the proportion of each item and the relationship between the items.
|
||||
/// || 环形图主要用于显示每一项的比例以及各项之间的关系。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/RingChart", 20)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -15,5 +19,18 @@ namespace XCharts.Runtime
|
||||
RemoveData();
|
||||
Ring.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default multiple ring chart.
|
||||
/// || 默认多圆环图。
|
||||
/// </summary>
|
||||
public void DefaultMultipleRingChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.label.show = false;
|
||||
AddData(0, UnityEngine.Random.Range(30, 90), 100, "data2");
|
||||
AddData(0, UnityEngine.Random.Range(30, 90), 100, "data3");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Scatter chart is mainly used to show the relationship between two data dimensions.
|
||||
/// || 散点图主要用于展现两个数据维度之间的关系。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/ScatterChart", 17)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
@@ -24,5 +28,21 @@ namespace XCharts.Runtime
|
||||
RemoveData();
|
||||
Scatter.AddDefaultSerie(this, GenerateDefaultSerieName());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default bubble chart.
|
||||
/// || 默认气泡图。
|
||||
/// </summary>
|
||||
public void DefaultBubbleChart()
|
||||
{
|
||||
CheckChartInit();
|
||||
var serie = GetSerie(0);
|
||||
serie.itemStyle.borderWidth = 2f;
|
||||
serie.itemStyle.borderColor = theme.GetColor(0);
|
||||
serie.itemStyle.opacity = 0.35f;
|
||||
serie.symbol.sizeType = SymbolSizeType.FromData;
|
||||
serie.symbol.dataScale = 0.3f;
|
||||
serie.symbol.maxSize = 30f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// A simplified bar chart is a simplified mode of a bar chart that provides better performance by simplifying components and configurations.
|
||||
/// || 简化柱状图是柱状图的简化模式,通过简化组件和配置,拥有更好的性能。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/SimplifiedBarChart", 27)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// A simplified candlestick chart is a simplified mode of a bar chart that provides better performance by simplifying components and configurations.
|
||||
/// || 简化K线图是K线图的简化模式,通过简化组件和配置,拥有更好的性能。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/SimplifiedCandlestickChart", 28)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
|
||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// A simplified line chart is a simplified mode of a bar chart that provides better performance by simplifying components and configurations.
|
||||
/// || 简化折线图是折线图的简化模式,通过简化组件和配置,拥有更好的性能。
|
||||
/// </summary>
|
||||
[AddComponentMenu("XCharts/SimplifiedLineChart", 26)]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(RectTransform))]
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// the animation info.
|
||||
/// |动画配置参数。
|
||||
/// ||动画配置参数。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[System.Serializable]
|
||||
@@ -20,50 +20,50 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// whether enable animation.
|
||||
/// |是否开启动画效果。
|
||||
/// ||是否开启动画效果。
|
||||
/// </summary>
|
||||
public bool enable { get { return m_Enable; } set { m_Enable = value; } }
|
||||
/// <summary>
|
||||
/// whether enable reverse animation.
|
||||
/// |是否开启反向动画效果。
|
||||
/// ||是否开启反向动画效果。
|
||||
/// </summary>
|
||||
public bool reverse { get { return m_Reverse; } set { m_Reverse = value; } }
|
||||
/// <summary>
|
||||
/// the delay time before animation start.
|
||||
/// |动画开始前的延迟时间。
|
||||
/// ||动画开始前的延迟时间。
|
||||
/// </summary>
|
||||
public float delay { get { return m_Delay; } set { m_Delay = value; } }
|
||||
/// <summary>
|
||||
/// the duration of animation.
|
||||
/// |动画的时长。
|
||||
/// ||动画的时长。
|
||||
/// </summary>
|
||||
public float duration { get { return m_Duration; } set { m_Duration = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// the callback function of animation start.
|
||||
/// |动画开始的回调。
|
||||
/// ||动画开始的回调。
|
||||
/// </summary>
|
||||
public Action OnAnimationStart { get; set; }
|
||||
/// <summary>
|
||||
/// the callback function of animation end.
|
||||
/// |动画结束的回调。
|
||||
/// ||动画结束的回调。
|
||||
/// </summary>
|
||||
public Action OnAnimationEnd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// the delegate function of animation delay.
|
||||
/// |动画延迟的委托函数。
|
||||
/// ||动画延迟的委托函数。
|
||||
/// </summary>
|
||||
public AnimationDelayFunction delayFunction { get; set; }
|
||||
/// <summary>
|
||||
/// the delegate function of animation duration.
|
||||
/// |动画时长的委托函数。
|
||||
/// ||动画时长的委托函数。
|
||||
/// </summary>
|
||||
public AnimationDurationFunction durationFunction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reset animation.
|
||||
/// |重置动画。
|
||||
/// ||重置动画。
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
@@ -86,7 +86,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Start animation.
|
||||
/// |开始动画。
|
||||
/// ||开始动画。
|
||||
/// </summary>
|
||||
/// <param name="reset">是否重置上一次的参数</param>
|
||||
public void Start(bool reset = true)
|
||||
@@ -119,7 +119,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Pause animation.
|
||||
/// |暂停动画。
|
||||
/// ||暂停动画。
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
@@ -130,7 +130,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Resume animation.
|
||||
/// |恢复动画。
|
||||
/// ||恢复动画。
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// End animation.
|
||||
/// |结束动画。
|
||||
/// ||结束动画。
|
||||
/// </summary>
|
||||
public void End()
|
||||
{
|
||||
@@ -159,7 +159,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Initialize animation.
|
||||
/// |初始化动画。
|
||||
/// ||初始化动画。
|
||||
/// </summary>
|
||||
/// <param name="curr">当前进度</param>
|
||||
/// <param name="dest">目标进度</param>
|
||||
@@ -187,7 +187,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Whether animation is finish.
|
||||
/// |动画是否结束。
|
||||
/// ||动画是否结束。
|
||||
/// </summary>
|
||||
public bool IsFinish()
|
||||
{
|
||||
@@ -201,7 +201,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Whether animation is in delay.
|
||||
/// |动画是否在延迟中。
|
||||
/// ||动画是否在延迟中。
|
||||
/// </summary>
|
||||
public bool IsInDelay()
|
||||
{
|
||||
@@ -213,7 +213,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Whether animation is in index delay.
|
||||
/// |动画是否在索引延迟中。
|
||||
/// ||动画是否在索引延迟中。
|
||||
/// </summary>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <returns></returns>
|
||||
@@ -227,7 +227,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Get animation delay.
|
||||
/// |获取动画延迟。
|
||||
/// ||获取动画延迟。
|
||||
/// </summary>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <returns></returns>
|
||||
@@ -381,7 +381,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Fade in animation.
|
||||
/// |淡入动画。
|
||||
/// ||淡入动画。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[System.Serializable]
|
||||
@@ -391,7 +391,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Fade out animation.
|
||||
/// |淡出动画。
|
||||
/// ||淡出动画。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[System.Serializable]
|
||||
@@ -401,7 +401,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Data change animation.
|
||||
/// |数据变更动画。
|
||||
/// ||数据变更动画。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[System.Serializable]
|
||||
@@ -411,7 +411,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Data addition animation.
|
||||
/// |数据新增动画。
|
||||
/// ||数据新增动画。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[System.Serializable]
|
||||
@@ -421,7 +421,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Data hiding animation.
|
||||
/// |数据隐藏动画。
|
||||
/// ||数据隐藏动画。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[System.Serializable]
|
||||
@@ -431,7 +431,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Interactive animation of charts.
|
||||
/// |交互动画。
|
||||
/// ||交互动画。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[System.Serializable]
|
||||
@@ -443,17 +443,17 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// the mlvalue of width.
|
||||
/// |宽度的多样式数值。
|
||||
/// ||宽度的多样式数值。
|
||||
/// </summary>
|
||||
public MLValue width { get { return m_Width; } set { m_Width = value; } }
|
||||
/// <summary>
|
||||
/// the mlvalue of radius.
|
||||
/// |半径的多样式数值。
|
||||
/// ||半径的多样式数值。
|
||||
/// </summary>
|
||||
public MLValue radius { get { return m_Radius; } set { m_Radius = value; } }
|
||||
/// <summary>
|
||||
/// the mlvalue of offset. Such as the offset of the pie chart when the sector is selected.
|
||||
/// |交互的多样式数值。如饼图的扇形选中时的偏移。
|
||||
/// ||交互的多样式数值。如饼图的扇形选中时的偏移。
|
||||
/// </summary>
|
||||
public MLValue offset { get { return m_Offset; } set { m_Offset = value; } }
|
||||
|
||||
|
||||
@@ -8,32 +8,32 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// he default. An animation playback mode will be selected according to the actual situation.
|
||||
/// |默认。内部会根据实际情况选择一种动画播放方式。
|
||||
/// ||默认。内部会根据实际情况选择一种动画播放方式。
|
||||
/// </summary>
|
||||
Default,
|
||||
/// <summary>
|
||||
/// Play the animation from left to right.
|
||||
/// |从左往右播放动画。
|
||||
/// ||从左往右播放动画。
|
||||
/// </summary>
|
||||
LeftToRight,
|
||||
/// <summary>
|
||||
/// Play the animation from bottom to top.
|
||||
/// |从下往上播放动画。
|
||||
/// ||从下往上播放动画。
|
||||
/// </summary>
|
||||
BottomToTop,
|
||||
/// <summary>
|
||||
/// Play animations from the inside out.
|
||||
/// |由内到外播放动画。
|
||||
/// ||由内到外播放动画。
|
||||
/// </summary>
|
||||
InsideOut,
|
||||
/// <summary>
|
||||
/// Play the animation along the path.
|
||||
/// |沿着路径播放动画。当折线图从左到右无序或有折返时,可以使用该模式。
|
||||
/// ||沿着路径播放动画。当折线图从左到右无序或有折返时,可以使用该模式。
|
||||
/// </summary>
|
||||
AlongPath,
|
||||
/// <summary>
|
||||
/// Play the animation clockwise.
|
||||
/// |顺时针播放动画。
|
||||
/// ||顺时针播放动画。
|
||||
/// </summary>
|
||||
Clockwise,
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// the animation of serie. support animation type: fadeIn, fadeOut, change, addition.
|
||||
/// |动画组件,用于控制图表的动画播放。支持配置五种动画表现:FadeIn(渐入动画),FadeOut(渐出动画),Change(变更动画),Addition(新增动画),Interaction(交互动画)。
|
||||
/// ||动画组件,用于控制图表的动画播放。支持配置五种动画表现:FadeIn(渐入动画),FadeOut(渐出动画),Change(变更动画),Addition(新增动画),Interaction(交互动画)。
|
||||
/// 按作用的对象可以分为两类:SerieAnimation(系列动画)和DataAnimation(数据动画)。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
@@ -79,53 +79,63 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Whether to enable animation.
|
||||
/// |是否开启动画效果。
|
||||
/// ||是否开启动画效果。
|
||||
/// </summary>
|
||||
public bool enable { get { return m_Enable; } set { m_Enable = value; } }
|
||||
/// <summary>
|
||||
/// The type of animation.
|
||||
/// |动画类型。
|
||||
/// ||动画类型。
|
||||
/// </summary>
|
||||
public AnimationType type { get { return m_Type; } set { m_Type = value; } }
|
||||
public AnimationType type
|
||||
{
|
||||
get { return m_Type; }
|
||||
set
|
||||
{
|
||||
m_Type = value;
|
||||
if (m_Type != AnimationType.Default)
|
||||
{
|
||||
context.type = m_Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to set graphic number threshold to animation. Animation will be disabled when graphic number is larger than threshold.
|
||||
/// |是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。
|
||||
/// ||是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。
|
||||
/// </summary>
|
||||
public int threshold { get { return m_Threshold; } set { m_Threshold = value; } }
|
||||
/// <summary>
|
||||
/// Animation updates independently of Time.timeScale.
|
||||
/// |动画是否受TimeScaled的影响。默认为 false 受TimeScaled的影响。
|
||||
/// ||动画是否受TimeScaled的影响。默认为 false 受TimeScaled的影响。
|
||||
/// </summary>
|
||||
public bool unscaledTime { get { return m_UnscaledTime; } set { m_UnscaledTime = value; } }
|
||||
/// <summary>
|
||||
/// Fade in animation configuration.
|
||||
/// |渐入动画配置。
|
||||
/// ||渐入动画配置。
|
||||
/// </summary>
|
||||
public AnimationFadeIn fadeIn { get { return m_FadeIn; } }
|
||||
/// <summary>
|
||||
/// Fade out animation configuration.
|
||||
/// |渐出动画配置。
|
||||
/// ||渐出动画配置。
|
||||
/// </summary>
|
||||
public AnimationFadeOut fadeOut { get { return m_FadeOut; } }
|
||||
/// <summary>
|
||||
/// Update data animation configuration.
|
||||
/// |数据变更动画配置。
|
||||
/// ||数据变更动画配置。
|
||||
/// </summary>
|
||||
public AnimationChange change { get { return m_Change; } }
|
||||
/// <summary>
|
||||
/// Add data animation configuration.
|
||||
/// |数据新增动画配置。
|
||||
/// ||数据新增动画配置。
|
||||
/// </summary>
|
||||
public AnimationAddition addition { get { return m_Addition; } }
|
||||
/// <summary>
|
||||
/// Data hiding animation configuration.
|
||||
/// |数据隐藏动画配置。
|
||||
/// ||数据隐藏动画配置。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public AnimationHiding hiding { get { return m_Hiding; } }
|
||||
/// <summary>
|
||||
/// Interaction animation configuration.
|
||||
/// |交互动画配置。
|
||||
/// ||交互动画配置。
|
||||
/// </summary>
|
||||
public AnimationInteraction interaction { get { return m_Interaction; } }
|
||||
|
||||
@@ -150,7 +160,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// The actived animation.
|
||||
/// |当前激活的动画。
|
||||
/// ||当前激活的动画。
|
||||
/// </summary>
|
||||
public AnimationInfo activedAnimation
|
||||
{
|
||||
@@ -166,7 +176,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Start fadein animation.
|
||||
/// |开始渐入动画。
|
||||
/// ||开始渐入动画。
|
||||
/// </summary>
|
||||
public void FadeIn()
|
||||
{
|
||||
@@ -176,7 +186,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Restart the actived animation.
|
||||
/// |重启当前激活的动画。
|
||||
/// ||重启当前激活的动画。
|
||||
/// </summary>
|
||||
public void Restart()
|
||||
{
|
||||
@@ -190,7 +200,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Start fadeout animation.
|
||||
/// |开始渐出动画。
|
||||
/// ||开始渐出动画。
|
||||
/// </summary>
|
||||
public void FadeOut()
|
||||
{
|
||||
@@ -199,7 +209,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Start additon animation.
|
||||
/// |开始数据新增动画。
|
||||
/// ||开始数据新增动画。
|
||||
/// </summary>
|
||||
public void Addition()
|
||||
{
|
||||
@@ -212,7 +222,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Pause all animations.
|
||||
/// |暂停所有动画。
|
||||
/// ||暂停所有动画。
|
||||
/// </summary>
|
||||
public void Pause()
|
||||
{
|
||||
@@ -224,7 +234,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Resume all animations.
|
||||
/// |恢复所有动画。
|
||||
/// ||恢复所有动画。
|
||||
/// </summary>
|
||||
public void Resume()
|
||||
{
|
||||
@@ -247,7 +257,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Initialize animation configuration.
|
||||
/// |初始化动画配置。
|
||||
/// ||初始化动画配置。
|
||||
/// </summary>
|
||||
/// <param name="curr">当前进度</param>
|
||||
/// <param name="dest">目标进度</param>
|
||||
@@ -276,7 +286,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Initialize animation configuration.
|
||||
/// |初始化动画配置。
|
||||
/// ||初始化动画配置。
|
||||
/// </summary>
|
||||
/// <param name="paths">路径坐标点列表</param>
|
||||
/// <param name="isY">是Y轴还是X轴</param>
|
||||
@@ -304,12 +314,6 @@ namespace XCharts.Runtime
|
||||
}
|
||||
var sp = paths[startIndex];
|
||||
var ep = paths[paths.Count - 1];
|
||||
if (sp == anim.context.currPoint && ep == anim.context.destPoint)
|
||||
{
|
||||
return;
|
||||
}
|
||||
anim.context.currPoint = sp;
|
||||
anim.context.destPoint = ep;
|
||||
var currDetailProgress = isY ? sp.y : sp.x;
|
||||
var totalDetailProgress = isY ? ep.y : ep.x;
|
||||
if (context.type == AnimationType.AlongPath)
|
||||
@@ -328,6 +332,12 @@ namespace XCharts.Runtime
|
||||
m_LinePathLastPos = sp;
|
||||
context.currentPathDistance = 0;
|
||||
}
|
||||
if (sp == anim.context.currPoint && ep == anim.context.destPoint)
|
||||
{
|
||||
return;
|
||||
}
|
||||
anim.context.currPoint = sp;
|
||||
anim.context.destPoint = ep;
|
||||
anim.Init(currDetailProgress, totalDetailProgress, paths.Count - 1);
|
||||
}
|
||||
|
||||
@@ -377,7 +387,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// whther animaiton is data animation. BottomToTop and InsideOut are data animation.
|
||||
/// |是否为数据动画。BottomToTop和InsideOut类型的为数据动画。
|
||||
/// ||是否为数据动画。BottomToTop和InsideOut类型的为数据动画。
|
||||
/// </summary>
|
||||
public bool IsDataAnimation()
|
||||
{
|
||||
@@ -386,7 +396,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// whther animaiton is serie animation. LeftToRight, AlongPath and Clockwise are serie animation.
|
||||
/// |是否为系列动画。LeftToRight、AlongPath和Clockwise类型的为系列动画。
|
||||
/// ||是否为系列动画。LeftToRight、AlongPath和Clockwise类型的为系列动画。
|
||||
/// </summary>
|
||||
public bool IsSerieAnimation()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Angle axis of Polar Coordinate.
|
||||
/// |极坐标系的角度轴。
|
||||
/// ||极坐标系的角度轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(PolarCoord))]
|
||||
@@ -16,7 +16,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Starting angle of axis. 0 degrees by default, standing for right position of center.
|
||||
/// |起始刻度的角度,默认为 0 度,即圆心的正右方。
|
||||
/// ||起始刻度的角度,默认为 0 度,即圆心的正右方。
|
||||
/// </summary>
|
||||
public float startAngle
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace XCharts.Runtime
|
||||
if (axis.IsCategory() || !axis.show) return;
|
||||
double tempMinValue = 0;
|
||||
double tempMaxValue = 0;
|
||||
SeriesHelper.GetYMinMaxValue(chart, axis.polarIndex, true, axis.inverse, out tempMinValue,
|
||||
SeriesHelper.GetYMinMaxValue(chart, axis.polarIndex, axis.inverse, out tempMinValue,
|
||||
out tempMaxValue, true);
|
||||
AxisHelper.AdjustMinMaxValue(axis, ref tempMinValue, ref tempMaxValue, true);
|
||||
if (tempMinValue != axis.context.minValue || tempMaxValue != axis.context.maxValue)
|
||||
|
||||
@@ -6,69 +6,69 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The axis in rectangular coordinate.
|
||||
/// |直角坐标系的坐标轴组件。
|
||||
/// ||直角坐标系的坐标轴组件。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Axis : MainComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// the type of axis.
|
||||
/// |坐标轴类型。
|
||||
/// ||坐标轴类型。
|
||||
/// </summary>
|
||||
public enum AxisType
|
||||
{
|
||||
/// <summary>
|
||||
/// Numerical axis, suitable for continuous data.
|
||||
/// |数值轴。适用于连续数据。
|
||||
/// ||数值轴。适用于连续数据。
|
||||
/// </summary>
|
||||
Value,
|
||||
/// <summary>
|
||||
/// Category axis, suitable for discrete category data. Data should only be set via data for this type.
|
||||
/// |类目轴。适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。serie的数据第0维数据对应坐标轴data的index。
|
||||
/// ||类目轴。适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。serie的数据第0维数据对应坐标轴data的index。
|
||||
/// </summary>
|
||||
Category,
|
||||
/// <summary>
|
||||
/// Log axis, suitable for log data.
|
||||
/// |对数轴。适用于对数数据。
|
||||
/// ||对数轴。适用于对数数据。
|
||||
/// </summary>
|
||||
Log,
|
||||
/// <summary>
|
||||
/// Time axis, suitable for continuous time series data.
|
||||
/// |时间轴。适用于连续的时序数据。
|
||||
/// ||时间轴。适用于连续的时序数据。
|
||||
/// </summary>
|
||||
Time
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the type of axis min and max value.
|
||||
/// |坐标轴最大最小刻度显示类型。
|
||||
/// ||坐标轴最大最小刻度显示类型。
|
||||
/// </summary>
|
||||
public enum AxisMinMaxType
|
||||
{
|
||||
/// <summary>
|
||||
/// 0 - maximum.
|
||||
/// |0-最大值。
|
||||
/// ||0-最大值。
|
||||
/// </summary>
|
||||
Default,
|
||||
/// <summary>
|
||||
/// minimum - maximum.
|
||||
/// |最小值-最大值。
|
||||
/// ||最小值-最大值。
|
||||
/// </summary>
|
||||
MinMax,
|
||||
/// <summary>
|
||||
/// Customize the minimum and maximum.
|
||||
/// |自定义最小值最大值。
|
||||
/// ||自定义最小值最大值。
|
||||
/// </summary>
|
||||
Custom,
|
||||
/// <summary>
|
||||
/// [since("v3.7.0")]minimum - maximum, automatically calculate the appropriate values.
|
||||
/// |[since("v3.7.0")]最小值-最大值。自动计算合适的值。
|
||||
/// ||[since("v3.7.0")]最小值-最大值。自动计算合适的值。
|
||||
/// </summary>
|
||||
MinMaxAuto,
|
||||
}
|
||||
/// <summary>
|
||||
/// the position of axis in grid.
|
||||
/// |坐标轴在Grid中的位置
|
||||
/// ||坐标轴在Grid中的位置
|
||||
/// </summary>
|
||||
public enum AxisPosition
|
||||
{
|
||||
@@ -106,6 +106,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected AxisLabel m_AxisLabel = AxisLabel.defaultAxisLabel;
|
||||
[SerializeField] protected AxisSplitLine m_SplitLine = AxisSplitLine.defaultSplitLine;
|
||||
[SerializeField] protected AxisSplitArea m_SplitArea = AxisSplitArea.defaultSplitArea;
|
||||
[SerializeField] protected AxisAnimation m_Animation = new AxisAnimation();
|
||||
[SerializeField][Since("v3.2.0")] protected AxisMinorTick m_MinorTick = AxisMinorTick.defaultMinorTick;
|
||||
[SerializeField][Since("v3.2.0")] protected AxisMinorSplitLine m_MinorSplitLine = AxisMinorSplitLine.defaultMinorSplitLine;
|
||||
[SerializeField][Since("v3.4.0")] protected LabelStyle m_IndicatorLabel = new LabelStyle() { numericFormatter = "f2" };
|
||||
@@ -114,7 +115,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show axis.
|
||||
/// |是否显示坐标轴。
|
||||
/// ||是否显示坐标轴。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
@@ -123,7 +124,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the type of axis.
|
||||
/// |坐标轴类型。
|
||||
/// ||坐标轴类型。
|
||||
/// </summary>
|
||||
public AxisType type
|
||||
{
|
||||
@@ -132,7 +133,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the type of axis minmax.
|
||||
/// |坐标轴刻度最大最小值显示类型。
|
||||
/// ||坐标轴刻度最大最小值显示类型。
|
||||
/// </summary>
|
||||
public AxisMinMaxType minMaxType
|
||||
{
|
||||
@@ -141,7 +142,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The index of the grid on which the axis are located, by default, is in the first grid.
|
||||
/// |坐标轴所在的 grid 的索引,默认位于第一个 grid。
|
||||
/// ||坐标轴所在的 grid 的索引,默认位于第一个 grid。
|
||||
/// </summary>
|
||||
public int gridIndex
|
||||
{
|
||||
@@ -150,7 +151,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The index of the polar on which the axis are located, by default, is in the first polar.
|
||||
/// |坐标轴所在的 ploar 的索引,默认位于第一个 polar。
|
||||
/// ||坐标轴所在的 ploar 的索引,默认位于第一个 polar。
|
||||
/// </summary>
|
||||
public int polarIndex
|
||||
{
|
||||
@@ -159,7 +160,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The index of the parallel on which the axis are located, by default, is in the first parallel.
|
||||
/// |坐标轴所在的 parallel 的索引,默认位于第一个 parallel。
|
||||
/// ||坐标轴所在的 parallel 的索引,默认位于第一个 parallel。
|
||||
/// </summary>
|
||||
public int parallelIndex
|
||||
{
|
||||
@@ -168,7 +169,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the position of axis in grid.
|
||||
/// |坐标轴在Grid中的位置。
|
||||
/// ||坐标轴在Grid中的位置。
|
||||
/// </summary>
|
||||
public AxisPosition position
|
||||
{
|
||||
@@ -177,7 +178,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the offset of axis from the default position. Useful when the same position has multiple axes.
|
||||
/// |坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
|
||||
/// ||坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
|
||||
/// </summary>
|
||||
public float offset
|
||||
{
|
||||
@@ -186,7 +187,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The minimun value of axis.Valid when `minMaxType` is `Custom`
|
||||
/// |设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
|
||||
/// ||设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
|
||||
/// </summary>
|
||||
public double min
|
||||
{
|
||||
@@ -195,7 +196,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The maximum value of axis.Valid when `minMaxType` is `Custom`
|
||||
/// |设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
|
||||
/// ||设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
|
||||
/// </summary>
|
||||
public double max
|
||||
{
|
||||
@@ -204,7 +205,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Number of segments that the axis is split into.
|
||||
/// |坐标轴的期望的分割段数。默认为0表示自动分割。
|
||||
/// ||坐标轴的期望的分割段数。默认为0表示自动分割。
|
||||
/// </summary>
|
||||
public int splitNumber
|
||||
{
|
||||
@@ -213,7 +214,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Compulsively set segmentation interval for axis.This is unavailable for category axis.
|
||||
/// |强制设置坐标轴分割间隔。无法在类目轴中使用。
|
||||
/// ||强制设置坐标轴分割间隔。无法在类目轴中使用。
|
||||
/// </summary>
|
||||
public double interval
|
||||
{
|
||||
@@ -222,7 +223,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The boundary gap on both sides of a coordinate axis, which is valid only for category axis with type: 'Category'.
|
||||
/// |坐标轴两边是否留白。只对类目轴有效。
|
||||
/// ||坐标轴两边是否留白。只对类目轴有效。
|
||||
/// </summary>
|
||||
public bool boundaryGap
|
||||
{
|
||||
@@ -231,7 +232,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Base of logarithm, which is valid only for numeric axes with type: 'Log'.
|
||||
/// |对数轴的底数,只在对数轴(type:'Log')中有效。
|
||||
/// ||对数轴的底数,只在对数轴(type:'Log')中有效。
|
||||
/// </summary>
|
||||
public float logBase
|
||||
{
|
||||
@@ -244,7 +245,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// On the log axis, if base e is the natural number, and is true, logBase fails.
|
||||
/// |对数轴是否以自然数 e 为底数,为 true 时 logBase 失效。
|
||||
/// ||对数轴是否以自然数 e 为底数,为 true 时 logBase 失效。
|
||||
/// </summary>
|
||||
public bool logBaseE
|
||||
{
|
||||
@@ -253,8 +254,8 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The max number of axis data cache.
|
||||
/// |The first data will be remove when the size of axis data is larger then maxCache.
|
||||
/// |可缓存的最大数据量。默认为0没有限制,大于0时超过指定值会移除旧数据再插入新数据。
|
||||
/// ||The first data will be remove when the size of axis data is larger then maxCache.
|
||||
/// ||可缓存的最大数据量。默认为0没有限制,大于0时超过指定值会移除旧数据再插入新数据。
|
||||
/// </summary>
|
||||
public int maxCache
|
||||
{
|
||||
@@ -263,7 +264,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
|
||||
/// |最大最小值向上取整的倍率。默认为0时自动计算。
|
||||
/// ||最大最小值向上取整的倍率。默认为0时自动计算。
|
||||
/// </summary>
|
||||
public double ceilRate
|
||||
{
|
||||
@@ -272,7 +273,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether the axis are reversed or not. Invalid in `Category` axis.
|
||||
/// |是否反向坐标轴。在类目轴中无效。
|
||||
/// ||是否反向坐标轴。在类目轴中无效。
|
||||
/// </summary>
|
||||
public bool inverse
|
||||
{
|
||||
@@ -281,7 +282,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether the positive position of axis is in clockwise. True for clockwise by default.
|
||||
/// |刻度增长是否按顺时针,默认顺时针。
|
||||
/// ||刻度增长是否按顺时针,默认顺时针。
|
||||
/// </summary>
|
||||
public bool clockwise
|
||||
{
|
||||
@@ -290,7 +291,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Category data, available in type: 'Category' axis.
|
||||
/// |类目数据,在类目轴(type: 'category')中有效。
|
||||
/// ||类目数据,在类目轴(type: 'category')中有效。
|
||||
/// </summary>
|
||||
public List<string> data
|
||||
{
|
||||
@@ -307,7 +308,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis Line.
|
||||
/// |坐标轴轴线。
|
||||
/// ||坐标轴轴线。
|
||||
/// </summary>
|
||||
public AxisLine axisLine
|
||||
{
|
||||
@@ -316,7 +317,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis name.
|
||||
/// |坐标轴名称。
|
||||
/// ||坐标轴名称。
|
||||
/// </summary>
|
||||
public AxisName axisName
|
||||
{
|
||||
@@ -325,7 +326,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis tick.
|
||||
/// |坐标轴刻度。
|
||||
/// ||坐标轴刻度。
|
||||
/// </summary>
|
||||
public AxisTick axisTick
|
||||
{
|
||||
@@ -334,7 +335,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis label.
|
||||
/// |坐标轴刻度标签。
|
||||
/// ||坐标轴刻度标签。
|
||||
/// </summary>
|
||||
public AxisLabel axisLabel
|
||||
{
|
||||
@@ -343,7 +344,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis split line.
|
||||
/// |坐标轴分割线。
|
||||
/// ||坐标轴分割线。
|
||||
/// </summary>
|
||||
public AxisSplitLine splitLine
|
||||
{
|
||||
@@ -352,7 +353,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis split area.
|
||||
/// |坐标轴分割区域。
|
||||
/// ||坐标轴分割区域。
|
||||
/// </summary>
|
||||
public AxisSplitArea splitArea
|
||||
{
|
||||
@@ -361,7 +362,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis minor tick.
|
||||
/// |坐标轴次刻度。
|
||||
/// ||坐标轴次刻度。
|
||||
/// </summary>
|
||||
public AxisMinorTick minorTick
|
||||
{
|
||||
@@ -370,7 +371,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// axis minor split line.
|
||||
/// |坐标轴次分割线。
|
||||
/// ||坐标轴次分割线。
|
||||
/// </summary>
|
||||
public AxisMinorSplitLine minorSplitLine
|
||||
{
|
||||
@@ -379,7 +380,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Style of axis tooltip indicator label.
|
||||
/// |指示器文本的样式。Tooltip为Cross时使用。
|
||||
/// ||指示器文本的样式。Tooltip为Cross时使用。
|
||||
/// </summary>
|
||||
public LabelStyle indicatorLabel
|
||||
{
|
||||
@@ -387,8 +388,17 @@ namespace XCharts.Runtime
|
||||
set { if (value != null) { m_IndicatorLabel = value; SetComponentDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// animation of axis.
|
||||
/// ||坐标轴动画。
|
||||
/// </summary>
|
||||
public AxisAnimation animation
|
||||
{
|
||||
get { return m_Animation; }
|
||||
set { if (value != null) { m_Animation = value; SetComponentDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to add new data at the head or at the end of the list.
|
||||
/// |添加新数据时是在列表的头部还是尾部加入。
|
||||
/// ||添加新数据时是在列表的头部还是尾部加入。
|
||||
/// </summary>
|
||||
public bool insertDataToHead
|
||||
{
|
||||
@@ -439,7 +449,7 @@ namespace XCharts.Runtime
|
||||
splitArea.ClearVerticesDirty();
|
||||
minorTick.ClearVerticesDirty();
|
||||
minorSplitLine.ClearVerticesDirty();
|
||||
indicatorLabel.ClearComponentDirty();
|
||||
indicatorLabel.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public override void SetComponentDirty()
|
||||
@@ -474,6 +484,7 @@ namespace XCharts.Runtime
|
||||
axis.minorTick = minorTick.Clone();
|
||||
axis.minorSplitLine = minorSplitLine.Clone();
|
||||
axis.indicatorLabel = indicatorLabel.Clone();
|
||||
axis.animation = animation.Clone();
|
||||
axis.icons = new List<Sprite>();
|
||||
axis.data = new List<string>();
|
||||
ChartHelper.CopyList(axis.data, data);
|
||||
@@ -505,6 +516,7 @@ namespace XCharts.Runtime
|
||||
minorTick.Copy(axis.minorTick);
|
||||
minorSplitLine.Copy(axis.minorSplitLine);
|
||||
indicatorLabel.Copy(axis.indicatorLabel);
|
||||
animation.Copy(axis.animation);
|
||||
ChartHelper.CopyList(data, axis.data);
|
||||
ChartHelper.CopyList<Sprite>(icons, axis.icons);
|
||||
}
|
||||
@@ -597,12 +609,14 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (maxCache > 0)
|
||||
{
|
||||
if (context.addedDataCount < m_Data.Count)
|
||||
context.addedDataCount = m_Data.Count;
|
||||
while (m_Data.Count >= maxCache)
|
||||
{
|
||||
RemoveData(m_InsertDataToHead ? m_Data.Count - 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
context.addedDataCount++;
|
||||
if (m_InsertDataToHead)
|
||||
m_Data.Insert(0, category);
|
||||
else
|
||||
@@ -611,6 +625,16 @@ namespace XCharts.Runtime
|
||||
SetAllDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the history data count.
|
||||
/// ||获得添加过的历史数据总数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetAddedDataCount()
|
||||
{
|
||||
return context.addedDataCount < m_Data.Count ? m_Data.Count : context.addedDataCount;
|
||||
}
|
||||
|
||||
public void RemoveData(int dataIndex)
|
||||
{
|
||||
context.isNeedUpdateFilterData = true;
|
||||
@@ -713,11 +737,18 @@ namespace XCharts.Runtime
|
||||
if (IsCategory() && boundaryGap)
|
||||
{
|
||||
var each = axisLength / data.Count;
|
||||
return (float) (each * (value + 0.5f));
|
||||
return (float)(each * (value + 0.5f));
|
||||
}
|
||||
else if (IsLog())
|
||||
{
|
||||
var logValue = GetLogValue(value);
|
||||
var logMin = GetLogValue(context.minValue);
|
||||
var logMax = GetLogValue(context.maxValue);
|
||||
return axisLength * (float)((logValue - logMin) / (logMax - logMin));
|
||||
}
|
||||
else
|
||||
{
|
||||
return axisLength * (float) ((value - context.minValue) / context.minMaxRange);
|
||||
return axisLength * (float)((value - context.minValue) / context.minMaxRange);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,7 +756,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (context.minMaxRange > 0)
|
||||
{
|
||||
return axisLength * ((float) (value / context.minMaxRange));
|
||||
return axisLength * ((float)(value / context.minMaxRange));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -789,7 +820,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (context.labelObjectList[i] != null)
|
||||
{
|
||||
var text = AxisHelper.GetLabelName(this, coordinateWidth, i, context.minValue, context.maxValue, dataZoom, forcePercent);
|
||||
var text = AxisHelper.GetLabelName(this, coordinateWidth, i, context.destMinValue, context.destMaxValue, dataZoom, forcePercent);
|
||||
context.labelObjectList[i].SetText(text);
|
||||
}
|
||||
}
|
||||
@@ -803,10 +834,27 @@ namespace XCharts.Runtime
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
internal void UpdateMinMaxValue(double minValue, double maxValue)
|
||||
internal void UpdateMinMaxValue(double minValue, double maxValue, bool needAnimation = false)
|
||||
{
|
||||
context.minValue = minValue;
|
||||
context.maxValue = maxValue;
|
||||
if (needAnimation)
|
||||
{
|
||||
if (context.lastMinValue == 0 && context.lastMaxValue == 0)
|
||||
{
|
||||
context.minValue = minValue;
|
||||
context.maxValue = maxValue;
|
||||
}
|
||||
context.lastMinValue = context.minValue;
|
||||
context.lastMaxValue = context.maxValue;
|
||||
context.destMinValue = minValue;
|
||||
context.destMaxValue = maxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
context.minValue = minValue;
|
||||
context.maxValue = maxValue;
|
||||
context.destMinValue = minValue;
|
||||
context.destMaxValue = maxValue;
|
||||
}
|
||||
double tempRange = maxValue - minValue;
|
||||
if (context.minMaxRange != tempRange)
|
||||
{
|
||||
@@ -823,11 +871,13 @@ namespace XCharts.Runtime
|
||||
if (value <= 0 || value == 1)
|
||||
return 0;
|
||||
else
|
||||
return logBaseE ? (float) Math.Log(value) : (float) Math.Log(value, logBase);
|
||||
return logBaseE ? (float)Math.Log(value) : (float)Math.Log(value, logBase);
|
||||
}
|
||||
|
||||
public double GetLogMinIndex()
|
||||
{
|
||||
if (context.minValue <= 0 || context.minValue == 1)
|
||||
return 0;
|
||||
return logBaseE ?
|
||||
Math.Log(context.minValue) :
|
||||
Math.Log(context.minValue, logBase);
|
||||
@@ -835,6 +885,8 @@ namespace XCharts.Runtime
|
||||
|
||||
public double GetLogMaxIndex()
|
||||
{
|
||||
if (context.maxValue <= 0 || context.maxValue == 1)
|
||||
return 0;
|
||||
return logBaseE ?
|
||||
Math.Log(context.maxValue) :
|
||||
Math.Log(context.maxValue, logBase);
|
||||
@@ -864,8 +916,7 @@ namespace XCharts.Runtime
|
||||
0 :
|
||||
(context.maxValue < 0 ?
|
||||
axisLength :
|
||||
(float) (Math.Abs(context.minValue) * (axisLength /
|
||||
(Math.Abs(context.minValue) + Math.Abs(context.maxValue))))
|
||||
(float)(Math.Abs(context.minValue) * (axisLength / (Math.Abs(context.minValue) + Math.Abs(context.maxValue))))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
63
Runtime/Component/Axis/AxisAnimation.cs
Normal file
63
Runtime/Component/Axis/AxisAnimation.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// animation style of axis.
|
||||
/// ||坐标轴动画配置。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[Since("v3.9.0")]
|
||||
public class AxisAnimation : ChildComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private float m_Duration;
|
||||
[SerializeField] private bool m_UnscaledTime;
|
||||
|
||||
/// <summary>
|
||||
/// whether to enable animation.
|
||||
/// ||是否开启动画。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the duration of animation (ms). When it is set to 0, the animation duration will be automatically calculated according to the serie.
|
||||
/// ||动画时长(ms)。 默认设置为0时,会自动获取serie的动画时长。
|
||||
/// </summary>
|
||||
public float duration
|
||||
{
|
||||
get { return m_Duration; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Duration, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Animation updates independently of Time.timeScale.
|
||||
/// ||动画是否受TimeScaled的影响。默认为 false 受TimeScaled的影响。
|
||||
/// </summary>
|
||||
public bool unscaledTime
|
||||
{
|
||||
get { return m_UnscaledTime; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_UnscaledTime, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
public AxisAnimation Clone()
|
||||
{
|
||||
var animation = new AxisAnimation
|
||||
{
|
||||
show = show,
|
||||
duration = duration,
|
||||
unscaledTime = unscaledTime
|
||||
};
|
||||
return animation;
|
||||
}
|
||||
|
||||
public void Copy(AxisAnimation animation)
|
||||
{
|
||||
show = animation.show;
|
||||
duration = animation.duration;
|
||||
unscaledTime = animation.unscaledTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/AxisAnimation.cs.meta
Normal file
11
Runtime/Component/Axis/AxisAnimation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecce90a24f1e64ce2affa51992d56ac4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -32,23 +32,28 @@ namespace XCharts.Runtime
|
||||
public float top;
|
||||
/// <summary>
|
||||
/// the current minimun value.
|
||||
/// |当前最小值。
|
||||
/// ||当前最小值。
|
||||
/// </summary>
|
||||
public double minValue;
|
||||
public double lastMinValue { get; internal set; }
|
||||
public double destMinValue { get; internal set; }
|
||||
/// <summary>
|
||||
/// the current maximum value.
|
||||
/// |当前最大值。
|
||||
/// ||当前最大值。
|
||||
/// </summary>
|
||||
public double maxValue;
|
||||
public double lastMaxValue { get; internal set; }
|
||||
public double destMaxValue { get; internal set; }
|
||||
public bool needAnimation { get; internal set; }
|
||||
/// <summary>
|
||||
/// the offset of zero position.
|
||||
/// |坐标轴原点在坐标轴的偏移。
|
||||
/// ||坐标轴原点在坐标轴的偏移。
|
||||
/// </summary>
|
||||
public float offset;
|
||||
public double minMaxRange;
|
||||
/// <summary>
|
||||
/// the tick value of value axis.
|
||||
/// |数值轴时每个tick的数值。
|
||||
/// ||数值轴时每个tick的数值。
|
||||
/// </summary>
|
||||
public double tickValue;
|
||||
public float scaleWidth;
|
||||
@@ -61,6 +66,10 @@ namespace XCharts.Runtime
|
||||
public List<double> labelValueList { get { return m_LabelValueList; } }
|
||||
public List<ChartLabel> labelObjectList { get { return m_AxisLabelList; } }
|
||||
public int dataZoomStartIndex;
|
||||
/// <summary>
|
||||
/// 添加过的历史数据总数
|
||||
/// </summary>
|
||||
public int addedDataCount;
|
||||
|
||||
internal List<string> filterData;
|
||||
internal bool lastCheckInverse;
|
||||
@@ -76,6 +85,7 @@ namespace XCharts.Runtime
|
||||
|
||||
internal void Clear()
|
||||
{
|
||||
addedDataCount = 0;
|
||||
m_RuntimeData.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace XCharts
|
||||
|
||||
internal override void SetComponent(MainComponent component)
|
||||
{
|
||||
this.component = (T) component;
|
||||
this.component = (T)component;
|
||||
}
|
||||
|
||||
protected virtual Vector3 GetLabelPosition(float scaleWid, int i)
|
||||
@@ -109,11 +109,23 @@ namespace XCharts
|
||||
}
|
||||
else
|
||||
{
|
||||
var xRate = axis.context.minMaxRange / grid.context.width;
|
||||
var xValue = xRate * (chart.pointerPos.x - grid.context.x - axis.context.offset);
|
||||
if (axis.context.minValue > 0)
|
||||
xValue += axis.context.minValue;
|
||||
|
||||
double xValue;
|
||||
if (axis.IsLog())
|
||||
{
|
||||
var logBase = axis.logBase;
|
||||
var minLog = Math.Log(axis.context.minValue, logBase);
|
||||
var maxLog = Math.Log(axis.context.maxValue, logBase);
|
||||
var logRange = maxLog - minLog;
|
||||
var pointerLog = minLog + logRange * (chart.pointerPos.x - grid.context.x - axis.context.offset) / grid.context.width;
|
||||
xValue = Math.Pow(logBase, pointerLog);
|
||||
}
|
||||
else
|
||||
{
|
||||
var xRate = axis.context.minMaxRange / grid.context.width;
|
||||
xValue = xRate * (chart.pointerPos.x - grid.context.x - axis.context.offset);
|
||||
if (axis.context.minValue > 0)
|
||||
xValue += axis.context.minValue;
|
||||
}
|
||||
var labelY = axis.GetLabelObjectPosition(0).y;
|
||||
axis.context.pointerValue = xValue;
|
||||
axis.context.pointerLabelPosition = new Vector3(chart.pointerPos.x, labelY);
|
||||
@@ -140,8 +152,9 @@ namespace XCharts
|
||||
return;
|
||||
}
|
||||
|
||||
double tempMinValue = 0;
|
||||
double tempMaxValue = 0;
|
||||
double tempMinValue;
|
||||
double tempMaxValue;
|
||||
axis.context.needAnimation = Application.isPlaying && axis.animation.show;
|
||||
chart.GetSeriesMinMaxValue(axis, axisIndex, out tempMinValue, out tempMaxValue);
|
||||
|
||||
var dataZoom = chart.GetDataZoomOfAxis(axis);
|
||||
@@ -152,15 +165,15 @@ namespace XCharts
|
||||
else
|
||||
dataZoom.SetYAxisIndexValueInfo(axisIndex, ref tempMinValue, ref tempMaxValue);
|
||||
}
|
||||
if (tempMinValue != axis.context.minValue ||
|
||||
tempMaxValue != axis.context.maxValue ||
|
||||
|
||||
if (tempMinValue != axis.context.destMinValue ||
|
||||
tempMaxValue != axis.context.destMaxValue ||
|
||||
m_LastInterval != axis.interval ||
|
||||
m_LastSplitNumber != axis.splitNumber)
|
||||
{
|
||||
m_LastSplitNumber = axis.splitNumber;
|
||||
m_LastInterval = axis.interval;
|
||||
|
||||
axis.UpdateMinMaxValue(tempMinValue, tempMaxValue);
|
||||
axis.UpdateMinMaxValue(tempMinValue, tempMaxValue, axis.context.needAnimation);
|
||||
axis.context.offset = 0;
|
||||
axis.context.lastCheckInverse = axis.inverse;
|
||||
UpdateAxisTickValueList(axis);
|
||||
@@ -184,6 +197,36 @@ namespace XCharts
|
||||
chart.RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
if (axis.context.needAnimation && (axis.context.minValue != axis.context.destMinValue || axis.context.maxValue != axis.context.destMaxValue))
|
||||
{
|
||||
var duration = axis.animation.duration == 0
|
||||
? SeriesHelper.GetMinAnimationDuration(chart.series) / 1000f
|
||||
: axis.animation.duration / 1000f;
|
||||
var deltaTime = axis.animation.unscaledTime ? Time.unscaledDeltaTime : Time.deltaTime;
|
||||
var minDiff = axis.context.destMinValue - axis.context.lastMinValue;
|
||||
var maxDiff = axis.context.destMaxValue - axis.context.lastMaxValue;
|
||||
var minDelta = minDiff / duration * deltaTime;
|
||||
var maxDelta = maxDiff / duration * deltaTime;
|
||||
axis.context.minValue += minDelta;
|
||||
axis.context.maxValue += maxDelta;
|
||||
if ((minDiff > 0 && axis.context.minValue > axis.context.destMinValue)
|
||||
|| (minDiff < 0 && axis.context.minValue < axis.context.destMinValue))
|
||||
{
|
||||
axis.context.minValue = axis.context.destMinValue;
|
||||
axis.context.lastMinValue = axis.context.destMinValue;
|
||||
}
|
||||
if ((maxDiff > 0 && axis.context.maxValue > axis.context.destMaxValue)
|
||||
|| (maxDiff < 0 && axis.context.maxValue < axis.context.destMaxValue))
|
||||
{
|
||||
axis.context.maxValue = axis.context.destMaxValue;
|
||||
axis.context.lastMaxValue = axis.context.destMaxValue;
|
||||
}
|
||||
axis.context.minMaxRange = axis.context.maxValue - axis.context.minValue;
|
||||
UpdateAxisTickValueList(axis);
|
||||
UpdateAxisLabelText(axis);
|
||||
chart.RefreshChart();
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual void UpdateAxisLabelText(Axis axis)
|
||||
@@ -205,7 +248,7 @@ namespace XCharts
|
||||
{
|
||||
var lastCount = axis.context.labelValueList.Count;
|
||||
axis.context.tickValue = DateTimeUtil.UpdateTimeAxisDateTimeList(axis.context.labelValueList,
|
||||
(int) axis.context.minValue, (int) axis.context.maxValue, axis.splitNumber);
|
||||
(int)axis.context.minValue, (int)axis.context.maxValue, axis.splitNumber);
|
||||
|
||||
if (axis.context.labelValueList.Count != lastCount)
|
||||
axis.SetAllDirty();
|
||||
@@ -224,7 +267,11 @@ namespace XCharts
|
||||
|
||||
if (axis.interval == 0)
|
||||
{
|
||||
if (axis.splitNumber > 0)
|
||||
if (range >= double.MaxValue / 2)
|
||||
{
|
||||
tick = range / 4;
|
||||
}
|
||||
else if (axis.splitNumber > 0)
|
||||
{
|
||||
tick = range / axis.splitNumber;
|
||||
}
|
||||
@@ -242,7 +289,7 @@ namespace XCharts
|
||||
}
|
||||
var value = 0d;
|
||||
axis.context.tickValue = tick;
|
||||
if (Mathf.Approximately((float) (axis.context.minValue % tick), 0))
|
||||
if (Mathf.Approximately((float)(axis.context.minValue % tick), 0))
|
||||
{
|
||||
value = axis.context.minValue;
|
||||
}
|
||||
@@ -377,8 +424,8 @@ namespace XCharts
|
||||
{
|
||||
var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
|
||||
var labelName = AxisHelper.GetLabelName(axis, axisLength, i,
|
||||
axis.context.minValue,
|
||||
axis.context.maxValue,
|
||||
axis.context.destMinValue,
|
||||
axis.context.destMaxValue,
|
||||
dataZoom, isPercentStack);
|
||||
|
||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i,
|
||||
@@ -411,7 +458,7 @@ namespace XCharts
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
var posY = !axis.axisName.onZero && grid != null? grid.context.y : GetAxisLineXOrY() + offset.y;
|
||||
var posY = !axis.axisName.onZero && grid != null ? grid.context.y : GetAxisLineXOrY() + offset.y;
|
||||
switch (axis.axisName.labelStyle.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
@@ -448,7 +495,7 @@ namespace XCharts
|
||||
else
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
var posX = !axis.axisName.onZero && grid != null? grid.context.x : GetAxisLineXOrY() + offset.x;
|
||||
var posX = !axis.axisName.onZero && grid != null ? grid.context.x : GetAxisLineXOrY() + offset.x;
|
||||
switch (axis.axisName.labelStyle.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
@@ -582,6 +629,7 @@ namespace XCharts
|
||||
var minorTickWidth = axis.minorTick.GetWidth(theme.tickWidth);
|
||||
var minorTickLength = axis.minorTick.GetLength(theme.tickLength * 0.6f);
|
||||
var minorStartIndex = axis.IsTime() ? 0 : 1;
|
||||
var isLogAxis = axis.IsLog();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
|
||||
@@ -616,9 +664,23 @@ namespace XCharts
|
||||
}
|
||||
if (!hideTick)
|
||||
UGL.DrawLine(vh, new Vector3(pX, sY), new Vector3(pX, eY), tickWidth, tickColor);
|
||||
if (axis.minorTick.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
if (axis.minorTick.show && i >= minorStartIndex && (minorTickDistance > 0 || isLogAxis))
|
||||
{
|
||||
if (lastTickX <= axis.context.zeroX || (i == minorStartIndex && pX > axis.context.zeroX))
|
||||
if (isLogAxis)
|
||||
{
|
||||
var count = 0;
|
||||
var logRange = (axis.logBase - 1f);
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
var tickTotal = lastTickX + minorTickDistance;
|
||||
while (tickTotal < current && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
UGL.DrawLine(vh, new Vector3(tickTotal, sY), new Vector3(tickTotal, mY), minorTickWidth, minorTickColor);
|
||||
count++;
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
tickTotal = lastTickX + minorTickDistance;
|
||||
}
|
||||
}
|
||||
else if (lastTickX <= axis.context.zeroX || (i == minorStartIndex && pX > axis.context.zeroX))
|
||||
{
|
||||
var tickTotal = pX - minorTickDistance;
|
||||
while (tickTotal > lastTickX)
|
||||
@@ -675,9 +737,23 @@ namespace XCharts
|
||||
}
|
||||
if (!hideTick)
|
||||
UGL.DrawLine(vh, new Vector3(sX, pY), new Vector3(eX, pY), tickWidth, tickColor);
|
||||
if (axis.minorTick.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
if (axis.minorTick.show && i >= minorStartIndex && (minorTickDistance > 0 || isLogAxis))
|
||||
{
|
||||
if (lastTickY <= axis.context.zeroY || (i == minorStartIndex && pY > axis.context.zeroY))
|
||||
if (isLogAxis)
|
||||
{
|
||||
var count = 0;
|
||||
var logRange = (axis.logBase - 1f);
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
var tickTotal = lastTickY + minorTickDistance;
|
||||
while (tickTotal < current && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
UGL.DrawLine(vh, new Vector3(sX, tickTotal), new Vector3(mX, tickTotal), minorTickWidth, minorTickColor);
|
||||
count++;
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
tickTotal = lastTickY + minorTickDistance;
|
||||
}
|
||||
}
|
||||
else if (lastTickY <= axis.context.zeroY || (i == minorStartIndex && pY > axis.context.zeroY))
|
||||
{
|
||||
var tickTotal = pY - minorTickDistance;
|
||||
while (tickTotal > lastTickY)
|
||||
@@ -789,10 +865,10 @@ namespace XCharts
|
||||
var minorLineWidth = axis.minorSplitLine.GetWidth(theme.lineWidth);
|
||||
var minorLineType = axis.minorSplitLine.GetType(theme.splitLineType);
|
||||
var minorStartIndex = axis.IsTime() ? 0 : 1;
|
||||
var isLogAxis = axis.IsLog();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);
|
||||
|
||||
if (axis.boundaryGap && axis.axisTick.alignWithLabel)
|
||||
current -= scaleWidth / 2;
|
||||
|
||||
@@ -832,9 +908,28 @@ namespace XCharts
|
||||
new Vector3(current, startY + splitLength),
|
||||
lineColor);
|
||||
}
|
||||
if (axis.minorSplitLine.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
if (axis.minorSplitLine.show && i >= minorStartIndex && (minorTickDistance > 0 || isLogAxis))
|
||||
{
|
||||
if (lastSplitX <= axis.context.zeroX || (i == minorStartIndex && current > axis.context.zeroX))
|
||||
if (isLogAxis)
|
||||
{
|
||||
var count = 0;
|
||||
var logRange = axis.logBase - 1f;
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
var tickTotal = lastSplitX + minorTickDistance;
|
||||
while (tickTotal < current && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(tickTotal, startY),
|
||||
new Vector3(tickTotal, startY + splitLength),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
tickTotal = lastSplitX + minorTickDistance;
|
||||
}
|
||||
}
|
||||
else if (lastSplitX <= axis.context.zeroX || (i == minorStartIndex && current > axis.context.zeroX))
|
||||
{
|
||||
var tickTotal = current - minorTickDistance;
|
||||
var count = 0;
|
||||
@@ -896,9 +991,28 @@ namespace XCharts
|
||||
new Vector3(startX + splitLength, current),
|
||||
lineColor);
|
||||
}
|
||||
if (axis.minorSplitLine.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
if (axis.minorSplitLine.show && i >= minorStartIndex && (minorTickDistance > 0 || isLogAxis))
|
||||
{
|
||||
if (lastSplitY <= axis.context.zeroY || (i == minorStartIndex && current > axis.context.zeroY))
|
||||
if (isLogAxis)
|
||||
{
|
||||
var count = 0;
|
||||
var logRange = (axis.logBase - 1f);
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
var tickTotal = lastSplitY + minorTickDistance;
|
||||
while (tickTotal < current && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(startX, tickTotal),
|
||||
new Vector3(startX + splitLength, tickTotal),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
minorTickDistance = scaleWidth * axis.GetLogValue(1 + (count + 1) * logRange / minorTickSplitNumber);
|
||||
tickTotal = lastSplitY + minorTickDistance;
|
||||
}
|
||||
}
|
||||
else if (lastSplitY <= axis.context.zeroY || (i == minorStartIndex && current > axis.context.zeroY))
|
||||
{
|
||||
var tickTotal = current - minorTickDistance;
|
||||
var count = 0;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace XCharts.Runtime
|
||||
var min = axis is YAxis ? 20 : 80;
|
||||
if (eachWid > min) return dataCount;
|
||||
var tick = Mathf.CeilToInt(min / eachWid);
|
||||
return (int)(dataCount / tick);
|
||||
return tick <= 1 ? dataCount : (int)(dataCount / tick);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -245,21 +245,20 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (index < 0)
|
||||
return 0;
|
||||
|
||||
int num = GetScaleNumber(axis, coordinateWidth, dataZoom);
|
||||
int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
||||
if (num <= 0)
|
||||
num = 1;
|
||||
|
||||
if (axis.IsTime() || axis.IsValue())
|
||||
{
|
||||
var value = axis.GetLabelValue(index);
|
||||
var lastValue = axis.GetLabelValue(index - 1);
|
||||
return axis.context.minMaxRange == 0 ? 0 :
|
||||
(float)(coordinateWidth * (value - lastValue) / axis.context.minMaxRange);
|
||||
var width = axis.context.minMaxRange == 0 ? 0 :
|
||||
(float)(coordinateWidth * ((value - lastValue) / axis.context.minMaxRange));
|
||||
return width;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = GetScaleNumber(axis, coordinateWidth, dataZoom);
|
||||
int splitNum = GetSplitNumber(axis, coordinateWidth, dataZoom);
|
||||
if (num <= 0)
|
||||
num = 1;
|
||||
var data = axis.GetDataList(dataZoom);
|
||||
if (axis.IsCategory() && data.Count > 0 && splitNum > 0)
|
||||
{
|
||||
@@ -344,7 +343,8 @@ namespace XCharts.Runtime
|
||||
int maxSplit = 0;
|
||||
maxValue = ChartHelper.GetMaxLogValue(maxValue, axis.logBase, axis.logBaseE, out maxSplit);
|
||||
minValue = ChartHelper.GetMinLogValue(minValue, axis.logBase, axis.logBaseE, out minSplit);
|
||||
var splitNumber = (minSplit > 0 && maxSplit > 0) ? (maxSplit + minSplit - 1) : (maxSplit + minSplit);
|
||||
|
||||
var splitNumber = maxSplit + minSplit;
|
||||
if (splitNumber > 15)
|
||||
splitNumber = 15;
|
||||
axis.splitNumber = splitNumber;
|
||||
@@ -543,11 +543,14 @@ namespace XCharts.Runtime
|
||||
/// <param name="axis"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetAxisValueSplitIndex(Axis axis, double value, int totalSplitNumber = -1)
|
||||
public static int GetAxisValueSplitIndex(Axis axis, double value, bool checkMaxCache, int totalSplitNumber = -1)
|
||||
{
|
||||
if (axis.IsCategory())
|
||||
{
|
||||
return (int)value;
|
||||
if (checkMaxCache)
|
||||
return axis.maxCache > 0 ? (int)value - (axis.GetAddedDataCount() - axis.data.Count) : (int)value;
|
||||
else
|
||||
return (int)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -632,7 +635,7 @@ namespace XCharts.Runtime
|
||||
var startX = grid.context.x + yAxis.offset;
|
||||
if (yAxis.IsRight())
|
||||
startX += grid.context.width;
|
||||
else if (yAxis.axisLine.onZero && relativedAxis != null && relativedAxis.IsValue()
|
||||
else if (yAxis.axisLine.onZero && relativedAxis != null && relativedAxis.IsValue()
|
||||
&& relativedAxis.gridIndex == yAxis.gridIndex)
|
||||
startX += relativedAxis.context.offset;
|
||||
return startX;
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to axis label.
|
||||
/// |坐标轴刻度标签的相关设置。
|
||||
/// ||坐标轴刻度标签的相关设置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisLabel : LabelStyle
|
||||
@@ -21,7 +21,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// The display interval of the axis label.
|
||||
/// |坐标轴刻度标签的显示间隔,在类目轴中有效。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。
|
||||
/// ||坐标轴刻度标签的显示间隔,在类目轴中有效。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。
|
||||
/// </summary>
|
||||
public int interval
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Set this to true so the axis labels face the inside direction.
|
||||
/// |刻度标签是否朝内,默认朝外。
|
||||
/// ||刻度标签是否朝内,默认朝外。
|
||||
/// </summary>
|
||||
public bool inside
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Show negative number as positive number.
|
||||
/// |将负数数值显示为正数。一般和`Serie`的`showAsPositiveNumber`配合使用。
|
||||
/// ||将负数数值显示为正数。一般和`Serie`的`showAsPositiveNumber`配合使用。
|
||||
/// </summary>
|
||||
public bool showAsPositiveNumber
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to display the first label.
|
||||
/// |是否显示第一个文本。
|
||||
/// ||是否显示第一个文本。
|
||||
/// </summary>
|
||||
public bool showStartLabel
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to display the last label.
|
||||
/// |是否显示最后一个文本。
|
||||
/// ||是否显示最后一个文本。
|
||||
/// </summary>
|
||||
public bool showEndLabel
|
||||
{
|
||||
@@ -106,18 +106,20 @@ namespace XCharts.Runtime
|
||||
|
||||
public new AxisLabel Clone()
|
||||
{
|
||||
var axisLabel = new AxisLabel();
|
||||
axisLabel.show = show;
|
||||
axisLabel.formatter = formatter;
|
||||
axisLabel.interval = interval;
|
||||
axisLabel.inside = inside;
|
||||
axisLabel.distance = distance;
|
||||
axisLabel.numericFormatter = numericFormatter;
|
||||
axisLabel.width = width;
|
||||
axisLabel.height = height;
|
||||
axisLabel.showStartLabel = showStartLabel;
|
||||
axisLabel.showEndLabel = showEndLabel;
|
||||
axisLabel.textLimit = textLimit.Clone();
|
||||
var axisLabel = new AxisLabel
|
||||
{
|
||||
show = show,
|
||||
formatter = formatter,
|
||||
interval = interval,
|
||||
inside = inside,
|
||||
distance = distance,
|
||||
numericFormatter = numericFormatter,
|
||||
width = width,
|
||||
height = height,
|
||||
showStartLabel = showStartLabel,
|
||||
showEndLabel = showEndLabel,
|
||||
textLimit = textLimit.Clone()
|
||||
};
|
||||
axisLabel.textStyle.Copy(textStyle);
|
||||
return axisLabel;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to axis line.
|
||||
/// |坐标轴轴线。
|
||||
/// ||坐标轴轴线。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class AxisLine : BaseLine
|
||||
@@ -15,7 +15,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// When mutiple axes exists, this option can be used to specify which axis can be "onZero" to.
|
||||
/// |X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上,只有在另一个轴为数值轴且包含 0 刻度时有效。
|
||||
/// ||X 轴或者 Y 轴的轴线是否在另一个轴的 0 刻度上,只有在另一个轴为数值轴且包含 0 刻度时有效。
|
||||
/// </summary>
|
||||
public bool onZero
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the arrow symbol of axis.
|
||||
/// |是否显示箭头。
|
||||
/// ||是否显示箭头。
|
||||
/// </summary>
|
||||
public bool showArrow
|
||||
{
|
||||
@@ -33,7 +33,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the arrow of line.
|
||||
/// |轴线箭头。
|
||||
/// ||轴线箭头。
|
||||
/// </summary>
|
||||
public ArrowStyle arrow
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Minor split line of axis in grid area.
|
||||
/// |坐标轴在 grid 区域中的次分隔线。次分割线会对齐次刻度线 minorTick。
|
||||
/// ||坐标轴在 grid 区域中的次分隔线。次分割线会对齐次刻度线 minorTick。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Since("v3.2.0")]
|
||||
@@ -16,12 +16,12 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// The distance between the split line and axis line.
|
||||
/// |刻度线与轴线的距离。
|
||||
/// ||刻度线与轴线的距离。
|
||||
/// </summary>
|
||||
public float distance { get { return m_Distance; } set { m_Distance = value; } }
|
||||
/// <summary>
|
||||
/// auto color.
|
||||
/// |自动设置颜色。
|
||||
/// ||自动设置颜色。
|
||||
/// </summary>
|
||||
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to axis minor tick.
|
||||
/// |坐标轴次刻度相关设置。注意:次刻度无法在类目轴中使用。
|
||||
/// ||坐标轴次刻度相关设置。注意:次刻度无法在类目轴中使用。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[Since("v3.2.0")]
|
||||
@@ -15,7 +15,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Number of segments that the axis is split into.
|
||||
/// |分隔线之间分割的刻度数。
|
||||
/// ||分隔线之间分割的刻度数。
|
||||
/// </summary>
|
||||
public int splitNumber
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// the name of axis.
|
||||
/// |坐标轴名称。
|
||||
/// ||坐标轴名称。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisName : ChildComponent
|
||||
@@ -17,7 +17,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show axis name.
|
||||
/// |是否显示坐标轴名称。
|
||||
/// ||是否显示坐标轴名称。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the name of axis.
|
||||
/// |坐标轴名称。
|
||||
/// ||坐标轴名称。
|
||||
/// </summary>
|
||||
public string name
|
||||
{
|
||||
@@ -35,7 +35,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether the axis name position are the same with 0 position of YAxis.
|
||||
/// |坐标轴名称的位置是否保持和Y轴0刻度一致。
|
||||
/// ||坐标轴名称的位置是否保持和Y轴0刻度一致。
|
||||
/// </summary>
|
||||
public bool onZero
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The text style of axis name.
|
||||
/// |文本样式。
|
||||
/// ||文本样式。
|
||||
/// </summary>
|
||||
public LabelStyle labelStyle
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Split area of axis in grid area, not shown by default.
|
||||
/// |坐标轴在 grid 区域中的分隔区域,默认不显示。
|
||||
/// ||坐标轴在 grid 区域中的分隔区域,默认不显示。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisSplitArea : ChildComponent
|
||||
@@ -16,7 +16,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Set this to true to show the splitArea.
|
||||
/// |是否显示分隔区域。
|
||||
/// ||是否显示分隔区域。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace XCharts.Runtime
|
||||
/// Color of split area. SplitArea color could also be set in color array,
|
||||
/// which the split lines would take as their colors in turns.
|
||||
/// Dark and light colors in turns are used by default.
|
||||
/// |分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
|
||||
/// ||分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
|
||||
/// </summary>
|
||||
public List<Color32> color
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Split line of axis in grid area.
|
||||
/// |坐标轴在 grid 区域中的分隔线。
|
||||
/// ||坐标轴在 grid 区域中的分隔线。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisSplitLine : BaseLine
|
||||
@@ -18,17 +18,17 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// The distance between the split line and axis line.
|
||||
/// |刻度线与轴线的距离。
|
||||
/// ||刻度线与轴线的距离。
|
||||
/// </summary>
|
||||
public float distance { get { return m_Distance; } set { m_Distance = value; } }
|
||||
/// <summary>
|
||||
/// auto color.
|
||||
/// |自动设置颜色。
|
||||
/// ||自动设置颜色。
|
||||
/// </summary>
|
||||
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
|
||||
/// <summary>
|
||||
/// Interval of Axis splitLine.
|
||||
/// |坐标轴分隔线的显示间隔。
|
||||
/// ||坐标轴分隔线的显示间隔。
|
||||
/// </summary>
|
||||
public int interval
|
||||
{
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the first split line.
|
||||
/// |是否显示第一条分割线。
|
||||
/// ||是否显示第一条分割线。
|
||||
/// </summary>
|
||||
public bool showStartLine
|
||||
{
|
||||
@@ -46,7 +46,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the last split line.
|
||||
/// |是否显示最后一条分割线。
|
||||
/// ||是否显示最后一条分割线。
|
||||
/// </summary>
|
||||
public bool showEndLine
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to axis tick.
|
||||
/// |坐标轴刻度相关设置。
|
||||
/// ||坐标轴刻度相关设置。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class AxisTick : BaseLine
|
||||
@@ -19,13 +19,13 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// The distance between the tick line and axis line.
|
||||
/// |刻度线与轴线的距离。
|
||||
/// ||刻度线与轴线的距离。
|
||||
/// </summary>
|
||||
public float distance { get { return m_Distance; } set { m_Distance = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// Align axis tick with label, which is available only when boundaryGap is set to be true in category axis.
|
||||
/// |类目轴中在 boundaryGap 为 true 的时候有效,可以保证刻度线和标签对齐。
|
||||
/// ||类目轴中在 boundaryGap 为 true 的时候有效,可以保证刻度线和标签对齐。
|
||||
/// </summary>
|
||||
public bool alignWithLabel
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Set this to true so the axis labels face the inside direction.
|
||||
/// |坐标轴刻度是否朝内,默认朝外。
|
||||
/// ||坐标轴刻度是否朝内,默认朝外。
|
||||
/// </summary>
|
||||
public bool inside
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to display the first tick.
|
||||
/// |是否显示第一个刻度。
|
||||
/// ||是否显示第一个刻度。
|
||||
/// </summary>
|
||||
public bool showStartTick
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to display the last tick.
|
||||
/// |是否显示最后一个刻度。
|
||||
/// ||是否显示最后一个刻度。
|
||||
/// </summary>
|
||||
public bool showEndTick
|
||||
{
|
||||
@@ -61,7 +61,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Number of segments that the axis is split into.
|
||||
/// |分隔线之间分割的刻度数。
|
||||
/// ||分隔线之间分割的刻度数。
|
||||
/// </summary>
|
||||
public int splitNumber
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Radial axis of polar coordinate.
|
||||
/// |极坐标系的径向轴。
|
||||
/// ||极坐标系的径向轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(PolarCoord))]
|
||||
|
||||
@@ -51,9 +51,9 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (axis == null) return;
|
||||
if (axis.IsCategory() || !axis.show) return;
|
||||
double tempMinValue = 0;
|
||||
double tempMaxValue = 0;
|
||||
SeriesHelper.GetXMinMaxValue(chart, axis.polarIndex, true, axis.inverse, out tempMinValue,
|
||||
double tempMinValue;
|
||||
double tempMaxValue;
|
||||
SeriesHelper.GetXMinMaxValue(chart, axis.polarIndex, axis.inverse, out tempMinValue,
|
||||
out tempMaxValue, true);
|
||||
AxisHelper.AdjustMinMaxValue(axis, ref tempMinValue, ref tempMaxValue, true);
|
||||
if (tempMinValue != axis.context.minValue || tempMaxValue != axis.context.maxValue)
|
||||
@@ -179,7 +179,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var outsideRaidus = totalWidth + radiusAxis.splitLine.GetWidth(chart.theme.axis.splitLineWidth) * 2;
|
||||
var splitLineColor = radiusAxis.splitLine.GetColor(chart.theme.axis.splitLineColor);
|
||||
UGL.DrawDoughnut(vh, cenPos, totalWidth, outsideRaidus, splitLineColor, Color.clear);
|
||||
UGL.DrawDoughnut(vh, cenPos, totalWidth, outsideRaidus, splitLineColor, ColorUtil.clearColor32);
|
||||
}
|
||||
}
|
||||
if (radiusAxis.show && radiusAxis.axisTick.show)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Single axis.
|
||||
/// |单轴。
|
||||
/// ||单轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[ComponentHandler(typeof(SingleAxisHander), true)]
|
||||
@@ -21,7 +21,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Orientation of the axis. By default, it's 'Horizontal'. You can set it to be 'Vertical' to make a vertical axis.
|
||||
/// |坐标轴朝向。默认为水平朝向。
|
||||
/// ||坐标轴朝向。默认为水平朝向。
|
||||
/// </summary>
|
||||
public Orient orient
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between component and the left side of the container.
|
||||
/// |组件离容器左侧的距离。
|
||||
/// ||组件离容器左侧的距离。
|
||||
/// </summary>
|
||||
public float left
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between component and the right side of the container.
|
||||
/// |组件离容器右侧的距离。
|
||||
/// ||组件离容器右侧的距离。
|
||||
/// </summary>
|
||||
public float right
|
||||
{
|
||||
@@ -48,7 +48,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between component and the top side of the container.
|
||||
/// |组件离容器上侧的距离。
|
||||
/// ||组件离容器上侧的距离。
|
||||
/// </summary>
|
||||
public float top
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between component and the bottom side of the container.
|
||||
/// |组件离容器下侧的距离。
|
||||
/// ||组件离容器下侧的距离。
|
||||
/// </summary>
|
||||
public float bottom
|
||||
{
|
||||
@@ -66,7 +66,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// width of axis.
|
||||
/// |坐标轴宽。
|
||||
/// ||坐标轴宽。
|
||||
/// </summary>
|
||||
public float width
|
||||
{
|
||||
@@ -75,7 +75,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// height of axis.
|
||||
/// |坐标轴高。
|
||||
/// ||坐标轴高。
|
||||
/// </summary>
|
||||
public float height
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The x axis in cartesian(rectangular) coordinate.
|
||||
/// |直角坐标系 grid 中的 x 轴。
|
||||
/// ||直角坐标系 grid 中的 x 轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(GridCoord))]
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The x axis in cartesian(rectangular) coordinate.
|
||||
/// |直角坐标系 grid 中的 y 轴。
|
||||
/// ||直角坐标系 grid 中的 y 轴。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(GridCoord), typeof(XAxis))]
|
||||
|
||||
@@ -6,22 +6,25 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Background component.
|
||||
/// |背景组件。
|
||||
/// ||背景组件。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DisallowMultipleComponent]
|
||||
[ComponentHandler(typeof(BackgroundHandler), false)]
|
||||
[ComponentHandler(typeof(BackgroundHandler), false, 0)]
|
||||
public class Background : MainComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Sprite m_Image;
|
||||
[SerializeField] private Image.Type m_ImageType;
|
||||
[SerializeField] private Color m_ImageColor = Color.white;
|
||||
[SerializeField][Since("v3.10.0")] private float m_ImageWidth = 0;
|
||||
[SerializeField][Since("v3.10.0")] private float m_ImageHeight = 0;
|
||||
[SerializeField] private bool m_AutoColor = true;
|
||||
[SerializeField][Since("v3.10.0")] private BorderStyle m_BorderStyle = new BorderStyle();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to enable the background component.
|
||||
/// |是否启用背景组件。
|
||||
/// ||是否启用背景组件。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
@@ -30,7 +33,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the image of background.
|
||||
/// |背景图。
|
||||
/// ||背景图。
|
||||
/// </summary>
|
||||
public Sprite image
|
||||
{
|
||||
@@ -40,7 +43,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// the fill type of background image.
|
||||
/// |背景图填充类型。
|
||||
/// ||背景图填充类型。
|
||||
/// </summary>
|
||||
public Image.Type imageType
|
||||
{
|
||||
@@ -57,9 +60,29 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetColor(ref m_ImageColor, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the width of background image.
|
||||
/// ||背景图宽度。
|
||||
/// </summary>
|
||||
public float imageWidth
|
||||
{
|
||||
get { return m_ImageWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ImageWidth, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the height of background image.
|
||||
/// ||背景图高度。
|
||||
/// </summary>
|
||||
public float imageHeight
|
||||
{
|
||||
get { return m_ImageHeight; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ImageHeight, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to use theme background color for component color when the background component is on.
|
||||
/// |当background组件开启时,是否自动使用主题背景色作为backgrounnd组件的颜色。当设置为false时,用imageColor作为颜色。
|
||||
/// ||当background组件开启时,是否自动使用主题背景色作为backgrounnd组件的颜色。当设置为false时,用imageColor作为颜色。
|
||||
/// </summary>
|
||||
public bool autoColor
|
||||
{
|
||||
@@ -67,6 +90,16 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the border style of background.
|
||||
/// ||背景边框样式。
|
||||
/// </summary>
|
||||
public BorderStyle borderStyle
|
||||
{
|
||||
get { return m_BorderStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_BorderStyle, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
public override void SetDefaultValue()
|
||||
{
|
||||
m_Show = true;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace XCharts.Runtime
|
||||
public override void InitComponent()
|
||||
{
|
||||
component.painter = chart.painter;
|
||||
component.refreshComponent = delegate()
|
||||
component.refreshComponent = delegate ()
|
||||
{
|
||||
var backgroundObj = ChartHelper.AddObject(s_BackgroundObjectName, chart.transform, chart.chartMinAnchor,
|
||||
chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||
@@ -27,7 +27,7 @@ namespace XCharts.Runtime
|
||||
backgroundImage.color = chart.theme.GetBackgroundColor(component);
|
||||
|
||||
backgroundObj.transform.SetSiblingIndex(0);
|
||||
backgroundObj.SetActive(component.show);
|
||||
backgroundObj.SetActive(component.show && component.image != null);
|
||||
};
|
||||
component.refreshComponent();
|
||||
}
|
||||
@@ -45,13 +45,12 @@ namespace XCharts.Runtime
|
||||
if (component.image != null)
|
||||
return;
|
||||
|
||||
var p1 = new Vector3(chart.chartX, chart.chartY + chart.chartHeight);
|
||||
var p2 = new Vector3(chart.chartX + chart.chartWidth, chart.chartY + chart.chartHeight);
|
||||
var p3 = new Vector3(chart.chartX + chart.chartWidth, chart.chartY);
|
||||
var p4 = new Vector3(chart.chartX, chart.chartY);
|
||||
var backgroundColor = chart.theme.GetBackgroundColor(component);
|
||||
|
||||
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, backgroundColor);
|
||||
var borderWidth = component.borderStyle.GetRuntimeBorderWidth();
|
||||
var borderColor = component.borderStyle.GetRuntimeBorderColor();
|
||||
var cornerRadius = component.borderStyle.GetRuntimeCornerRadius();
|
||||
UGL.DrawRoundRectangleWithBorder(vh, chart.chartRect, backgroundColor, backgroundColor, cornerRadius,
|
||||
borderWidth, borderColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,30 +4,30 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The style of area.
|
||||
/// |区域填充样式。
|
||||
/// ||区域填充样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class AreaStyle : ChildComponent, ISerieComponent, ISerieDataComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Origin position of area.
|
||||
/// |图形区域的起始位置。默认情况下,图形会从坐标轴轴线到数据间进行填充。如果需要填充的区域是坐标轴最大值到数据间,或者坐标轴最小值到数据间,则可以通过这个配置项进行设置。
|
||||
/// ||图形区域的起始位置。默认情况下,图形会从坐标轴轴线到数据间进行填充。如果需要填充的区域是坐标轴最大值到数据间,或者坐标轴最小值到数据间,则可以通过这个配置项进行设置。
|
||||
/// </summary>
|
||||
public enum AreaOrigin
|
||||
{
|
||||
/// <summary>
|
||||
/// to fill between axis line to data.
|
||||
/// |填充坐标轴轴线到数据间的区域。
|
||||
/// ||填充坐标轴轴线到数据间的区域。
|
||||
/// </summary>
|
||||
Auto,
|
||||
/// <summary>
|
||||
/// to fill between min axis value (when not inverse) to data.
|
||||
/// |填充坐标轴底部到数据间的区域。
|
||||
/// ||填充坐标轴底部到数据间的区域。
|
||||
/// </summary>
|
||||
Start,
|
||||
/// <summary>
|
||||
/// to fill between max axis value (when not inverse) to data.
|
||||
/// |填充坐标轴顶部到数据间的区域。
|
||||
/// ||填充坐标轴顶部到数据间的区域。
|
||||
/// </summary>
|
||||
End
|
||||
}
|
||||
@@ -42,7 +42,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Set this to false to prevent the areafrom showing.
|
||||
/// |是否显示区域填充。
|
||||
/// ||是否显示区域填充。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the origin of area.
|
||||
/// |区域填充的起始位置。
|
||||
/// ||区域填充的起始位置。
|
||||
/// </summary>
|
||||
public AreaOrigin origin
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of area,default use serie color.
|
||||
/// |区域填充的颜色,如果toColor不是默认值,则表示渐变色的起点颜色。
|
||||
/// ||区域填充的颜色,如果toColor不是默认值,则表示渐变色的起点颜色。
|
||||
/// </summary>
|
||||
public Color32 color
|
||||
{
|
||||
@@ -69,7 +69,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Gradient color, start color to toColor.
|
||||
/// |渐变色的终点颜色。
|
||||
/// ||渐变色的终点颜色。
|
||||
/// </summary>
|
||||
public Color32 toColor
|
||||
{
|
||||
@@ -78,7 +78,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0.
|
||||
/// |图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|
||||
/// ||图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|
||||
/// </summary>
|
||||
public float opacity
|
||||
{
|
||||
@@ -87,7 +87,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to fill only polygonal areas. Currently, only convex polygons are supported.
|
||||
/// |是否只填充多边形区域。目前只支持凸多边形。
|
||||
/// ||是否只填充多边形区域。目前只支持凸多边形。
|
||||
/// </summary>
|
||||
public bool innerFill
|
||||
{
|
||||
@@ -97,7 +97,7 @@ namespace XCharts.Runtime
|
||||
/// <summary>
|
||||
/// Whether to fill the gradient color to the top. The default is true, which means that the gradient color is filled to the top.
|
||||
/// If it is false, the gradient color is filled to the actual position.
|
||||
/// |渐变色是到顶部还是到实际位置。默认为true到顶部。
|
||||
/// ||渐变色是到顶部还是到实际位置。默认为true到顶部。
|
||||
/// </summary>
|
||||
public bool toTop
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// The widht of arrow.
|
||||
/// |箭头宽。
|
||||
/// ||箭头宽。
|
||||
/// </summary>
|
||||
public float width
|
||||
{
|
||||
@@ -25,7 +25,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The height of arrow.
|
||||
/// |箭头高。
|
||||
/// ||箭头高。
|
||||
/// </summary>
|
||||
public float height
|
||||
{
|
||||
@@ -34,7 +34,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The offset of arrow.
|
||||
/// |箭头偏移。
|
||||
/// ||箭头偏移。
|
||||
/// </summary>
|
||||
public float offset
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
/// <summary>
|
||||
/// The dent of arrow.
|
||||
/// |箭头的凹度。
|
||||
/// ||箭头的凹度。
|
||||
/// </summary>
|
||||
public float dent
|
||||
{
|
||||
@@ -53,7 +53,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// the color of arrow.
|
||||
/// |箭头颜色。
|
||||
/// ||箭头颜色。
|
||||
/// </summary>
|
||||
public Color32 color
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to base line.
|
||||
/// |线条基础配置。
|
||||
/// ||线条基础配置。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class BaseLine : ChildComponent
|
||||
@@ -14,7 +14,7 @@ namespace XCharts.Runtime
|
||||
|
||||
/// <summary>
|
||||
/// Set this to false to prevent the axis line from showing.
|
||||
/// |是否显示坐标轴轴线。
|
||||
/// ||是否显示坐标轴轴线。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user