mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 17:00:08 +00:00
Merge branch 'master' into 3.0
This commit is contained in:
@@ -340,7 +340,7 @@ slug: /api
|
||||
|SetSeriePainterMaterial()||public void SetSeriePainterMaterial(Material material)<br/>设置Serie Painter的材质球 |
|
||||
|SetTopPainterMaterial()||public void SetTopPainterMaterial(Material material)<br/>设置Top Painter的材质球 |
|
||||
|SetUpperPainterMaterial()||public void SetUpperPainterMaterial(Material material)<br/>设置Upper Painter的材质球 |
|
||||
|TriggerTooltip()|v3.7.0|public bool TriggerTooltip(int dataIndex)<br/>trigger tooltip by data index. |
|
||||
|TriggerTooltip()|v3.7.0|public bool TriggerTooltip(int dataIndex, int serieIndex = 0)<br/>trigger tooltip by data index. |
|
||||
|TriggerTooltip()|v3.7.0|public bool TriggerTooltip(Vector3 localPosition)<br/>trigger tooltip by chart local position. |
|
||||
|TryAddChartComponent()||public bool TryAddChartComponent(Type type)|
|
||||
|TryAddChartComponent<T>()||public bool TryAddChartComponent<T>() where T : MainComponent|
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.8.1](#v381)
|
||||
[v3.8.0](#v380)
|
||||
[v3.7.0](#v370)
|
||||
[v3.6.0](#v360)
|
||||
@@ -63,6 +64,18 @@
|
||||
|
||||
## master
|
||||
|
||||
## v3.8.1
|
||||
|
||||
* (2023.10.02) Release `v3.8.1` version
|
||||
* (2023.09.29) Fixed issue where `Bar` is set to `Bottom` when horizontal does not take effect
|
||||
* (2023.09.22) Added support for dashed lines in `Line`'s smooth curves
|
||||
* (2023.09.16) Fix to `Tooltip` reporting an exception when there is no data in the category axis (#279)
|
||||
* (2023.09.16) Fix to `Pie` drawing exception with no data (#278)
|
||||
* (2023.09.12) Added `Pie` `radiusGradient` to set the gradient effect in the radius direction
|
||||
* (2023.09.05) Improved the performance of LabelLine`s lineEndX in Pie
|
||||
* (2023.09.05) Fixed `TriggerTooltip()` interface not working for `Ring`
|
||||
* (2023.09.05) Fixed drawing error when `Radar` data is all zeros
|
||||
|
||||
## v3.8.0
|
||||
|
||||
Highlights:
|
||||
|
||||
@@ -1387,6 +1387,9 @@ The style of line.
|
||||
|width|0||the width of line.
|
||||
|length|0||the length of line.
|
||||
|opacity|1||Opacity of the line. Supports value from 0 to 1, and the line will not be drawn when set to 0.
|
||||
|dashLength|4|v3.8.1|the length of dash line. default value is 0, which means the length of dash line is 12 times of line width. Represents a multiple of the number of segments in a line chart.
|
||||
|dotLength|2|v3.8.1|the length of dot line. default value is 0, which means the length of dot line is 2 times of line width. Represents a multiple of the number of segments in a line chart.
|
||||
|gapLength|2|v3.8.1|the length of gap line. default value is 0, which means the length of gap line is 3 times of line width. Represents a multiple of the number of segments in a line chart.
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
@@ -1628,6 +1631,19 @@ Grid component.
|
||||
|
||||
> XCharts.Runtime.Pie : [Serie](#serie)
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="Pie">
|
||||
```
|
||||
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|radiusGradient|false|v3.8.1|Whether to use gradient color in pie chart.
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## PolarAxisTheme
|
||||
|
||||
> XCharts.Runtime.PolarAxisTheme : [BaseAxisTheme](#baseaxistheme)
|
||||
|
||||
BIN
Documentation~/en/img/xcharts.png
Normal file
BIN
Documentation~/en/img/xcharts.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
@@ -340,7 +340,7 @@ slug: /api
|
||||
|SetSeriePainterMaterial()||public void SetSeriePainterMaterial(Material material)<br/>设置Serie Painter的材质球 |
|
||||
|SetTopPainterMaterial()||public void SetTopPainterMaterial(Material material)<br/>设置Top Painter的材质球 |
|
||||
|SetUpperPainterMaterial()||public void SetUpperPainterMaterial(Material material)<br/>设置Upper Painter的材质球 |
|
||||
|TriggerTooltip()|v3.7.0|public bool TriggerTooltip(int dataIndex)<br/>尝试触发指定数据项的Tooltip. |
|
||||
|TriggerTooltip()|v3.7.0|public bool TriggerTooltip(int dataIndex, int serieIndex = 0)<br/>尝试触发指定数据项的Tooltip. |
|
||||
|TriggerTooltip()|v3.7.0|public bool TriggerTooltip(Vector3 localPosition)<br/>在指定的位置尝试触发Tooltip. |
|
||||
|TryAddChartComponent()||public bool TryAddChartComponent(Type type)|
|
||||
|TryAddChartComponent<T>()||public bool TryAddChartComponent<T>() where T : MainComponent|
|
||||
|
||||
@@ -6,6 +6,7 @@ slug: /changelog
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.8.1](#v381)
|
||||
[v3.8.0](#v380)
|
||||
[v3.7.0](#v370)
|
||||
[v3.6.0](#v360)
|
||||
@@ -68,6 +69,18 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
## v3.8.1
|
||||
|
||||
* (2023.10.02) 发布`v3.8.1`版本
|
||||
* (2023.09.29) 修复`Bar`在水平方向时`Label`设置为`Bottom`不生效的问题
|
||||
* (2023.09.22) 增加`Line`的平滑曲线对`Dash`虚线的支持
|
||||
* (2023.09.16) 修复`Tooltip`在类目轴无数据时异常报错的问题 (#279)
|
||||
* (2023.09.16) 修复`Pie`无数据时绘制异常的问题 (#278)
|
||||
* (2023.09.12) 增加`Pie`的`radiusGradient`可设置半径方向的渐变效果
|
||||
* (2023.09.05) 优化`LabelLine`的`lineEndX`在`Pie`中的表现
|
||||
* (2023.09.05) 修复`TriggerTooltip()`接口对`Ring`无效的问题
|
||||
* (2023.09.05) 修复`Radar`数据全为0时绘制报错的问题
|
||||
|
||||
## v3.8.0
|
||||
|
||||
版本要点:
|
||||
|
||||
@@ -1387,6 +1387,9 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|width|0||线宽。
|
||||
|length|0||线长。
|
||||
|opacity|1||线的透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|
||||
|dashLength|4|v3.8.1|虚线的长度。默认0时为线条宽度的12倍。在折线图中代表分割段数的倍数。
|
||||
|dotLength|2|v3.8.1|点线的长度。默认0时为线条宽度的3倍。在折线图中代表分割段数的倍数。
|
||||
|gapLength|2|v3.8.1|点线的长度。默认0时为线条宽度的3倍。在折线图中代表分割段数的倍数。
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
@@ -1628,6 +1631,19 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
> XCharts.Runtime.Pie : [Serie](#serie)
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="Pie">
|
||||
```
|
||||
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|radiusGradient|false|v3.8.1|是否开启半径方向的渐变效果。
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## PolarAxisTheme
|
||||
|
||||
> XCharts.Runtime.PolarAxisTheme : [BaseAxisTheme](#baseaxistheme)
|
||||
|
||||
BIN
Documentation~/zh/img/xcharts.png
Normal file
BIN
Documentation~/zh/img/xcharts.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 154 KiB |
@@ -29,16 +29,16 @@ slug: /support
|
||||
| ----- |--|--|--|--|--|--|
|
||||
| 订阅费用 | -- | `98`¥ | `298`¥ | 首年`1298`¥<br/>后续`298¥`* | 首年`1698`¥<br/>后续`298¥`* | `联系我们` |
|
||||
| 订阅时长 | -- | `7`天* | `1`年 | `1`年 | `1`年 | `1`年 |
|
||||
| 订阅席位 | -- | `1`个席位 | `1`个席位 |`1`个席位|`1`个席位|`5`个以上席位|
|
||||
| 订阅条件 | -- | | Github帐号 | Github帐号 |Github帐号<br/>企业银行帐号|Github帐号<br/>企业银行帐号|
|
||||
| 拥有席位 | -- | `1`个席位 | `1`个席位 |`1`个席位|`1`个席位|`5`个以上席位|
|
||||
| 增加席位 | -- | -- | -- | -- |支持|支持|
|
||||
| __`服务方式:`__|
|
||||
| 官方QQ群交流 | √ | √ | √ | √ | √ | √ |
|
||||
| QQ一对一交流 | | √ | √ | √ | √ | √ |
|
||||
| 专属VIP群交流 | | | √ | √ | √ | |
|
||||
| 专属VIP群交流 | | | √ | √ | √ | √ |
|
||||
| 微信交流 | | | | | √ | √(企业专属群) |
|
||||
| 电话交流 | | | | | | √ |
|
||||
| __`服务内容:`__|
|
||||
| 可商用 | √ | √ | √ | √ | √ | √ |
|
||||
| 可二次开发 | √ | √ | √ | √ | √ | √ |
|
||||
| 可商用可二次开发 | √ | √ | √ | √ | √ | √ |
|
||||
| 有问即答 | | √ | √ | √ | √ | √ |
|
||||
| 新手入门指导 | | √ | √ | √ | √ | √ |
|
||||
| 开发优化指导 | | √ | √ | √ | √ | √ |
|
||||
@@ -48,7 +48,8 @@ slug: /support
|
||||
| 可另付费定制 | | | √ | √ | √ | √ |
|
||||
| 可另付费加急 | | | √ | √ | √ | √ |
|
||||
| 扩展UI组件 | | | √ | √ | √ | √ |
|
||||
| 付费方式 | | | 二维码 | 二维码 | __对公转账__* | __对公转账__* |
|
||||
| 首页赞助展示 | | | | | | √ |
|
||||
| 付费方式 | | | 二维码 | 二维码 | __公对公转账__* | __公对公转账__* |
|
||||
| 支持开发票 | | | 普票 | 普票 | __专票__ | __专票__ |
|
||||
| 扩展图表购买 | | | 按需购买 | __全部免费__* | __全部免费__* | __全部免费__* |
|
||||
| 扩展图表源码 | | | 永久持有 | 永久持有 | 永久持有 | 永久持有 |
|
||||
@@ -61,6 +62,7 @@ slug: /support
|
||||
>*__`扩展图表`__ 购买后代码可永久持有和商用,1年的更新和技术支持。可继续订阅VIP延长服务时间。
|
||||
>*__`全部免费`__ 是指在订阅期间的`个人SVIP`和`企业VIP`的订阅用户,可免费使用全部的扩展图表。
|
||||
>*__`次年付费`__ 个人SVIP和企业VIP的首年和次年付费不一样,次年付费都是`298¥`。
|
||||
>*__`增加席位`__ 企业VIP支持增加席位,每个席位`298¥`一年。
|
||||
>*__`对公转账`__ 有开专票需求时,可用企业银行帐号进行公对公转账支付。二维码支付不支持开专票,只能开普票。发票默认都是电子发票。
|
||||
>*__`登记资料`__ 订阅成功后,需提供手机号和Github帐号进行登记,手机号用于确认归属,Github帐号用于下载源码。
|
||||
|
||||
@@ -68,7 +70,7 @@ slug: /support
|
||||
|
||||
扩展图表为另付费购买图表,只对订阅了`VIP`服务的用户开放购买。对于`个人SVIP`和`企业VIP`的订阅用户,所有扩展图表仓库在订阅期间可全部免费使用,不用再单独购买。
|
||||
|
||||
对所有已购买的扩展图表,源码可永久持有,并获得持续一年的更新支持和技术服务,一年后如需更新支持服务,可再继续订阅`VIP`服务。
|
||||
对所有已购买的扩展图表,源码可永久持有但不能传播,并获得持续一年的更新支持和技术服务,一年后如需更新支持等服务,可再继续订阅`VIP`服务。
|
||||
|
||||
|编号|扩展图表|扩展图表|价格|
|
||||
|--|--|--|--|
|
||||
|
||||
@@ -21,6 +21,9 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Width");
|
||||
PropertyField(prop, "m_Length");
|
||||
PropertyField(prop, "m_Opacity");
|
||||
PropertyField(prop, "m_DashLength");
|
||||
PropertyField(prop, "m_DotLength");
|
||||
PropertyField(prop, "m_GapLength");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_Ignore");
|
||||
PropertyField("m_IgnoreValue");
|
||||
PropertyField("m_ClickOffset");
|
||||
PropertyField("m_RadiusGradient");
|
||||
});
|
||||
PropertyField("m_ItemStyle");
|
||||
PropertyField("m_Animation");
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||

|
||||
|
||||
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extended charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, and treemap.
|
||||
|
||||
[XCharts3.0 Homepage](https://xcharts-team.github.io)
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
</a>
|
||||
</p>
|
||||
|
||||

|
||||
|
||||
一款基于`UGUI`的功能强大、简单易用的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十多种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`等扩展图表。
|
||||
|
||||
[XCharts 官方主页](https://xcharts-team.github.io)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace XCharts
|
||||
return;
|
||||
if (!grid.context.isPointerEnter)
|
||||
{
|
||||
axis.context.pointerValue = double.NaN;
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace XCharts.Runtime
|
||||
|
||||
if (!polar.context.isPointerEnter)
|
||||
{
|
||||
axis.context.pointerValue = double.NaN;
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private float m_Width = 0;
|
||||
[SerializeField] private float m_Length = 0;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 1;
|
||||
[SerializeField][Since("v3.8.1")] private float m_DashLength = 4;
|
||||
[SerializeField][Since("v3.8.1")] private float m_DotLength = 2;
|
||||
[SerializeField][Since("v3.8.1")] private float m_GapLength = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Whether show line.
|
||||
@@ -121,6 +124,39 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Opacity, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the length of dash line. default value is 0, which means the length of dash line is 12 times of line width.
|
||||
/// Represents a multiple of the number of segments in a line chart.
|
||||
/// |虚线的长度。默认0时为线条宽度的12倍。在折线图中代表分割段数的倍数。
|
||||
/// </summary>
|
||||
public float dashLength
|
||||
{
|
||||
get { return m_DashLength; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_DashLength, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the length of dot line. default value is 0, which means the length of dot line is 2 times of line width.
|
||||
/// Represents a multiple of the number of segments in a line chart.
|
||||
/// |点线的长度。默认0时为线条宽度的3倍。在折线图中代表分割段数的倍数。
|
||||
/// </summary>
|
||||
public float dotLength
|
||||
{
|
||||
get { return m_DotLength; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_DotLength, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the length of gap line. default value is 0, which means the length of gap line is 3 times of line width.
|
||||
/// Represents a multiple of the number of segments in a line chart.
|
||||
/// |点线的长度。默认0时为线条宽度的3倍。在折线图中代表分割段数的倍数。
|
||||
/// </summary>
|
||||
public float gapLength
|
||||
{
|
||||
get { return m_GapLength; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_GapLength, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public LineStyle()
|
||||
{ }
|
||||
|
||||
@@ -150,6 +186,9 @@ namespace XCharts.Runtime
|
||||
lineStyle.toColor2 = toColor2;
|
||||
lineStyle.width = width;
|
||||
lineStyle.opacity = opacity;
|
||||
lineStyle.dashLength = dashLength;
|
||||
lineStyle.dotLength = dotLength;
|
||||
lineStyle.gapLength = gapLength;
|
||||
return lineStyle;
|
||||
}
|
||||
|
||||
@@ -162,6 +201,14 @@ namespace XCharts.Runtime
|
||||
toColor2 = lineStyle.toColor2;
|
||||
width = lineStyle.width;
|
||||
opacity = lineStyle.opacity;
|
||||
dashLength = lineStyle.dashLength;
|
||||
dotLength = lineStyle.dotLength;
|
||||
gapLength = lineStyle.gapLength;
|
||||
}
|
||||
|
||||
public bool IsNotSolidLine()
|
||||
{
|
||||
return type != Type.Solid && type != Type.None;
|
||||
}
|
||||
|
||||
public Color32 GetColor()
|
||||
@@ -170,7 +217,7 @@ namespace XCharts.Runtime
|
||||
return m_Color;
|
||||
|
||||
var color = m_Color;
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -201,7 +248,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
if (m_Opacity != 1)
|
||||
{
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
@@ -230,7 +277,7 @@ namespace XCharts.Runtime
|
||||
else
|
||||
{
|
||||
var color = themeColor;
|
||||
color.a = (byte) (color.a * opacity);
|
||||
color.a = (byte)(color.a * opacity);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -671,11 +671,12 @@ namespace XCharts.Runtime
|
||||
/// |尝试触发指定数据项的Tooltip.
|
||||
/// </summary>
|
||||
/// <param name="dataIndex">数据项索引</param>
|
||||
/// <param name="serieIndex">Serie索引,默认为第0个Serie</param>
|
||||
/// <returns></returns>
|
||||
[Since("v3.7.0")]
|
||||
public bool TriggerTooltip(int dataIndex)
|
||||
public bool TriggerTooltip(int dataIndex, int serieIndex = 0)
|
||||
{
|
||||
var serie = GetSerie(0);
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie == null) return false;
|
||||
var dataPoints = serie.context.dataPoints;
|
||||
var dataPoint = Vector3.zero;
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace XCharts.Runtime
|
||||
[ExecuteInEditMode]
|
||||
public static class XChartsMgr
|
||||
{
|
||||
public static readonly string version = "3.8.0";
|
||||
public static readonly int versionDate = 20230903;
|
||||
public static readonly string version = "3.8.1";
|
||||
public static readonly int versionDate = 20231001;
|
||||
public static string fullVersion { get { return version + "-" + versionDate; } }
|
||||
|
||||
internal static List<BaseChart> chartList = new List<BaseChart>();
|
||||
|
||||
@@ -67,7 +67,10 @@ namespace XCharts.Runtime
|
||||
{
|
||||
case LabelStyle.Position.Bottom:
|
||||
var center = serieData.context.rect.center;
|
||||
return new Vector3(center.x, center.y - serieData.context.rect.height / 2);
|
||||
if(serie.context.isHorizontal)
|
||||
return new Vector3(center.x - serieData.context.rect.width/2, center.y);
|
||||
else
|
||||
return new Vector3(center.x, center.y - serieData.context.rect.height / 2);
|
||||
case LabelStyle.Position.Center:
|
||||
case LabelStyle.Position.Inside:
|
||||
return serieData.context.rect.center;
|
||||
@@ -193,6 +196,7 @@ namespace XCharts.Runtime
|
||||
var areaToColor = ColorUtil.clearColor32;
|
||||
var interacting = false;
|
||||
|
||||
serie.context.isHorizontal = isY;
|
||||
serie.containerIndex = m_SerieGrid.index;
|
||||
serie.containterInstanceId = m_SerieGrid.instanceId;
|
||||
serie.animation.InitProgress(axisXY, axisXY + axisLength);
|
||||
|
||||
@@ -296,6 +296,7 @@ namespace XCharts.Runtime
|
||||
var lineWidth = LineHelper.GetLineWidth(ref interacting, serie, chart.theme.serie.lineWidth);
|
||||
|
||||
axis.context.scaleWidth = scaleWid;
|
||||
serie.context.isHorizontal = isY;
|
||||
serie.containerIndex = m_SerieGrid.index;
|
||||
serie.containterInstanceId = m_SerieGrid.instanceId;
|
||||
|
||||
|
||||
@@ -285,8 +285,11 @@ namespace XCharts.Runtime
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, theme, serie.context.colorIndex);
|
||||
|
||||
var lastDataIsIgnore = datas[0].isIgnoreBreak;
|
||||
var smooth = serie.lineType == LineType.Smooth;
|
||||
var firstInGridPointIndex = serie.clip ? -1 : 1;
|
||||
var segmentCount = 0;
|
||||
var dashLength = serie.lineStyle.dashLength;
|
||||
var gapLength = serie.lineStyle.gapLength;
|
||||
var dotLength = serie.lineStyle.dotLength;
|
||||
for (int i = 1; i < dataCount; i++)
|
||||
{
|
||||
var cdata = datas[i];
|
||||
@@ -315,31 +318,45 @@ namespace XCharts.Runtime
|
||||
firstInGridPointIndex = i;
|
||||
if (isClip) isIgnore = true;
|
||||
}
|
||||
if (!smooth)
|
||||
if (serie.lineStyle.type == LineStyle.Type.None)
|
||||
{
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
{
|
||||
segmentCount++;
|
||||
var index = 0f;
|
||||
switch (serie.lineStyle.type)
|
||||
{
|
||||
case LineStyle.Type.Dashed:
|
||||
UGL.DrawDashLine(vh, lp, cp, lineWidth, lineColor, lineColor, 0, 0);
|
||||
handled = true;
|
||||
index = segmentCount % (dashLength + gapLength);
|
||||
if (index >= dashLength)
|
||||
isIgnore = true;
|
||||
break;
|
||||
case LineStyle.Type.Dotted:
|
||||
UGL.DrawDotLine(vh, lp, cp, lineWidth, lineColor, lineColor, 0, 0);
|
||||
handled = true;
|
||||
index = segmentCount % (dotLength + gapLength);
|
||||
if (index >= dotLength)
|
||||
isIgnore = true;
|
||||
break;
|
||||
case LineStyle.Type.DashDot:
|
||||
UGL.DrawDashDotLine(vh, lp, cp, lineWidth, lineColor, 0, 0, 0);
|
||||
handled = true;
|
||||
index = segmentCount % (dashLength + dotLength + 2 * gapLength);
|
||||
if (index >= dashLength && index < dashLength + gapLength)
|
||||
isIgnore = true;
|
||||
else if (index >= dashLength + gapLength + dotLength)
|
||||
isIgnore = true;
|
||||
break;
|
||||
case LineStyle.Type.DashDotDot:
|
||||
UGL.DrawDashDotDotLine(vh, lp, cp, lineWidth, lineColor, 0, 0, 0);
|
||||
handled = true;
|
||||
break;
|
||||
case LineStyle.Type.None:
|
||||
handled = true;
|
||||
index = segmentCount % (dashLength + 2 * dotLength + 3 * gapLength);
|
||||
if (index >= dashLength && index < dashLength + gapLength)
|
||||
isIgnore = true;
|
||||
else if (index >= dashLength + gapLength + dotLength && index < dashLength + dotLength + 2 * gapLength)
|
||||
isIgnore = true;
|
||||
else if (index >= dashLength + 2 * gapLength + 2 * dotLength)
|
||||
isIgnore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (handled)
|
||||
{
|
||||
lastDataIsIgnore = isIgnore;
|
||||
@@ -476,7 +493,7 @@ namespace XCharts.Runtime
|
||||
private static void UpdateNormalLineDrawPoints(Serie serie, Settings setting, VisualMap visualMap)
|
||||
{
|
||||
var isVisualMapGradient = VisualMapHelper.IsNeedGradient(visualMap);
|
||||
if (isVisualMapGradient || serie.clip)
|
||||
if (isVisualMapGradient || serie.clip || (serie.lineStyle.IsNotSolidLine()))
|
||||
{
|
||||
var dataPoints = serie.context.dataPoints;
|
||||
if (dataPoints.Count > 1)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
@@ -9,9 +11,21 @@ namespace XCharts.Runtime
|
||||
[SerieDataExtraField("m_Ignore", "m_Selected", "m_Radius")]
|
||||
public class Pie : Serie
|
||||
{
|
||||
[SerializeField][Since("v3.8.1")] private bool m_RadiusGradient = false;
|
||||
|
||||
public override SerieColorBy defaultColorBy { get { return SerieColorBy.Data; } }
|
||||
public override bool titleJustForSerie { get { return true; } }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to use gradient color in pie chart.
|
||||
/// | 是否开启半径方向的渐变效果。
|
||||
/// </summary>
|
||||
public bool radiusGradient
|
||||
{
|
||||
get { return m_RadiusGradient; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_RadiusGradient, value)) { SetVerticesDirty(); } }
|
||||
}
|
||||
|
||||
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||
{
|
||||
var serie = chart.AddSerie<Pie>(serieName);
|
||||
|
||||
@@ -333,7 +333,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawPie(VertexHelper vh, Serie serie)
|
||||
private void DrawPie(VertexHelper vh, Pie serie)
|
||||
{
|
||||
if (!serie.show || serie.animation.HasFadeOut())
|
||||
{
|
||||
@@ -348,6 +348,16 @@ namespace XCharts.Runtime
|
||||
&& !serie.animation.IsFadeIn() && !serie.animation.IsFadeOut();
|
||||
var data = serie.data;
|
||||
serie.animation.InitProgress(0, 360);
|
||||
if (data.Count == 0)
|
||||
{
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, null);
|
||||
var fillColor = ChartHelper.IsClearColor(itemStyle.backgroundColor) ?
|
||||
(Color32)chart.theme.legend.unableColor : itemStyle.backgroundColor;
|
||||
UGL.DrawDoughnut(vh, serie.context.center, serie.context.insideRadius,
|
||||
serie.context.outsideRadius, fillColor, fillColor, Color.clear, 0,
|
||||
360, itemStyle.borderWidth, itemStyle.borderColor, serie.gap / 2, chart.settings.cicleSmoothness,
|
||||
false, true, serie.radiusGradient);
|
||||
}
|
||||
for (int n = 0; n < data.Count; n++)
|
||||
{
|
||||
var serieData = data[n];
|
||||
@@ -387,7 +397,7 @@ namespace XCharts.Runtime
|
||||
UGL.DrawDoughnut(vh, offsetCenter, insideRadius,
|
||||
outsideRadius, color, toColor, Color.clear, serieData.context.startAngle,
|
||||
drawEndDegree, borderWidth, borderColor, serie.gap / 2, chart.settings.cicleSmoothness,
|
||||
needRoundCap, true);
|
||||
needRoundCap, true, serie.radiusGradient);
|
||||
DrawPieCenter(vh, serie, itemStyle, insideRadius);
|
||||
|
||||
if (serie.animation.CheckDetailBreak(serieData.context.toAngle))
|
||||
@@ -461,7 +471,7 @@ namespace XCharts.Runtime
|
||||
: pos2 + dire * lineLength2 + labelLine.GetEndSymbolOffset();
|
||||
if (labelLine.lineEndX != 0)
|
||||
{
|
||||
pos5.x = isLeft ? -Mathf.Abs(labelLine.lineEndX) : Mathf.Abs(labelLine.lineEndX);
|
||||
pos5.x = serie.context.center.x + (isLeft ? -Mathf.Abs(labelLine.lineEndX) : Mathf.Abs(labelLine.lineEndX));
|
||||
}
|
||||
serieData.context.labelLinePosition2 = pos2;
|
||||
serieData.context.labelPosition = pos5;
|
||||
|
||||
@@ -283,7 +283,8 @@ namespace XCharts.Runtime
|
||||
max = serie.context.dataMax;
|
||||
}
|
||||
}
|
||||
var radius = (float)(m_RadarCoord.context.dataRadius * (value - min) / (max - min));
|
||||
if (max - min == 0) continue;
|
||||
var radius = (float) (m_RadarCoord.context.dataRadius * (value - min) / (max - min));
|
||||
var currAngle = startAngle + (n + (m_RadarCoord.positionType == RadarCoord.PositionType.Between ? 0.5f : 0)) * angle;
|
||||
radius *= rate;
|
||||
if (n == 0)
|
||||
@@ -414,7 +415,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
lineColor = m_RadarCoord.outRangeColor;
|
||||
}
|
||||
var radius = (float)(max < 0 ? m_RadarCoord.context.dataRadius - m_RadarCoord.context.dataRadius * value / max :
|
||||
var radius = (float) (max < 0 ? m_RadarCoord.context.dataRadius - m_RadarCoord.context.dataRadius * value / max :
|
||||
m_RadarCoord.context.dataRadius * value / max);
|
||||
var currAngle = startAngle + (index + (m_RadarCoord.positionType == RadarCoord.PositionType.Between ? 0.5f : 0)) * angle;
|
||||
radius *= rate;
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace XCharts.Runtime
|
||||
param.color = color;
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter); ;
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
param.columns.Clear();
|
||||
|
||||
param.columns.Add(param.marker);
|
||||
@@ -111,7 +111,7 @@ namespace XCharts.Runtime
|
||||
|
||||
private Vector3 GetLabelLineEndPosition(Serie serie, SerieData serieData, LabelLine labelLine)
|
||||
{
|
||||
if (labelLine == null || !labelLine.show)
|
||||
if (labelLine == null || !labelLine.show)
|
||||
return serieData.context.labelLinePosition;
|
||||
var isRight = !serie.clockwise;
|
||||
var dire = isRight ? Vector3.right : Vector3.left;
|
||||
@@ -207,10 +207,13 @@ namespace XCharts.Runtime
|
||||
var startDegree = GetStartAngle(serie);
|
||||
var toDegree = GetToAngle(serie, degree);
|
||||
var insideRadius = outsideRadius - ringWidth;
|
||||
var halfAngle = startDegree + (toDegree - startDegree) / 2;
|
||||
var halfRadius = (outsideRadius + insideRadius) / 2;
|
||||
serieData.context.startAngle = startDegree;
|
||||
serieData.context.toAngle = toDegree;
|
||||
serieData.context.insideRadius = insideRadius;
|
||||
serieData.context.outsideRadius = serieData.radius > 0 ? serieData.radius : outsideRadius;
|
||||
serieData.context.position = ChartHelper.GetPosition(serie.context.center, halfAngle, halfRadius);
|
||||
UpdateLabelPosition(serieData);
|
||||
}
|
||||
AvoidLabelOverlap();
|
||||
|
||||
@@ -119,5 +119,9 @@ namespace XCharts.Runtime
|
||||
public Tooltip.Type tooltipType;
|
||||
public Tooltip.Trigger tooltipTrigger;
|
||||
public int totalDataIndex;
|
||||
/// <summary>
|
||||
/// 水平方向的
|
||||
/// </summary>
|
||||
public bool isHorizontal;
|
||||
}
|
||||
}
|
||||
@@ -201,6 +201,7 @@ namespace XCharts.Runtime
|
||||
/// <returns></returns>
|
||||
public static bool IsAllZeroValue(Serie serie, int dimension = 1)
|
||||
{
|
||||
if (serie.dataCount == 0) return false;
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
if (serieData.GetData(dimension) != 0) return false;
|
||||
|
||||
@@ -1590,7 +1590,7 @@ namespace XUGL
|
||||
|
||||
public static void DrawDoughnut(VertexHelper vh, Vector3 center, float insideRadius, float outsideRadius,
|
||||
Color32 color, Color32 toColor, Color32 emptyColor, float startDegree, float toDegree, float borderWidth,
|
||||
Color32 borderColor, float gap, float smoothness, bool roundCap = false, bool clockwise = true)
|
||||
Color32 borderColor, float gap, float smoothness, bool roundCap = false, bool clockwise = true, bool radiusGradient = true)
|
||||
{
|
||||
if (toDegree - startDegree == 0) return;
|
||||
if (gap > 0 && Mathf.Abs(toDegree - startDegree) >= 360) gap = 0;
|
||||
@@ -1785,10 +1785,19 @@ namespace XUGL
|
||||
center.y + insideRadius * Mathf.Cos(currAngle));
|
||||
if (isGradient)
|
||||
{
|
||||
var tcolor = Color32.Lerp(color, toColor, i * 1.0f / segments);
|
||||
if (i == 0 && (needSpace || needBorder))
|
||||
UGL.DrawTriangle(vh, p1, p2, p3, color, tcolor, tcolor);
|
||||
AddVertToVertexHelper(vh, p3, p4, tcolor, tcolor, i > 0);
|
||||
if (radiusGradient)
|
||||
{
|
||||
if (i == 0 && (needSpace || needBorder))
|
||||
UGL.DrawTriangle(vh, p1, p2, p3, color, toColor, toColor);
|
||||
AddVertToVertexHelper(vh, p3, p4, color, toColor, i > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
var tcolor = Color32.Lerp(color, toColor, i * 1.0f / segments);
|
||||
if (i == 0 && (needSpace || needBorder))
|
||||
UGL.DrawTriangle(vh, p1, p2, p3, color, tcolor, tcolor);
|
||||
AddVertToVertexHelper(vh, p3, p4, tcolor, tcolor, i > 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "com.monitor1394.xcharts",
|
||||
"displayName": "XCharts",
|
||||
"version": "3.8.0",
|
||||
"date": "20230903",
|
||||
"checkdate": "20230903",
|
||||
"version": "3.8.1",
|
||||
"date": "20231001",
|
||||
"checkdate": "20231001",
|
||||
"desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!",
|
||||
"unity": "2018.3",
|
||||
"description": "A charting and data visualization library for Unity.",
|
||||
|
||||
Reference in New Issue
Block a user