mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 22:40:10 +00:00
[feature][AreaStyle] support innerFill
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@@ -57,9 +57,9 @@
|
||||
|
||||
## master
|
||||
|
||||
* (2022.08.09) 修复`Serie`的数据项索引异常引起的其他问题
|
||||
* (2022.08.08) 优化`Serie`的数据项索引维护,增加检测和修复功能
|
||||
* (2022.07.29) 修复在某些`Unity`版本导入后图表创建异常的问题
|
||||
* (2022.08.09) 增加`AreaStyle`的`innerFill`参数支持填充凸多边形
|
||||
* (2022.08.08) 优化`Serie`的数据项索引维护,增加检测和修复功能,修复相关问题
|
||||
* (2022.07.29) 修复`Unity`版本兼容:在某些版本导入后图表创建异常的问题
|
||||
* (2022.07.29) 增加`Axis`为`Time`时间轴时,支持次刻度和次分割线
|
||||
* (2022.07.28) 优化`Radar`雷达图效果
|
||||
* (2022.07.28) 增加`Serie`的`colorBy`参数配置取色策略
|
||||
@@ -69,7 +69,7 @@
|
||||
* (2022.07.22) 增加`Serie`的三种状态`EmphasisStyle`,`BlurStyle`,`SelectStyle`
|
||||
* (2022.07.22) 去掉`AreaStyle`的`highlightColor`和`highlightToColor`参数
|
||||
* (2022.07.22) 去掉`Emphasis`,`EmphasisItemStyle`,`EmphasisLabelStyle`,`EmphasisLabelLine`组件
|
||||
* (2022.07.20) 文档支持用`Since`标识类从哪个版本开始支持
|
||||
* (2022.07.20) 增加`Since`特性对类的支持
|
||||
* (2022.07.20) 修复`Axis`在`Value`轴时,`AxisLabel`的`showStartLabel`和`showEndLabel`参数设置不生效的问题
|
||||
* (2022.07.19) 增加`Axis`的`MinorSplitLine`设置坐标轴次分割线
|
||||
* (2022.07.19) 增加`Axis`的`MinorTick`设置坐标轴次刻度
|
||||
@@ -107,7 +107,7 @@
|
||||
* (2022.06.25) 修复`DataZoom`开启时`Tooltip`显示数据不一致的问题 (#203)
|
||||
* (2022.06.25) 修复`Toolip`在类目轴无数据时绘制异常的问题 (#204)
|
||||
* (2022.06.25) 优化`Serie`设置`PlaceHolder`时的`Tooltip`表现
|
||||
* (2022.06.25) 增加`Since`标识配置参数从哪个版本开始支持
|
||||
* (2022.06.25) 增加`Since`特效用于标识配置参数从哪个版本开始支持
|
||||
* (2022.06.24) 优化`Painter`绘制层,`Top`层细分为`Upper`和`Top`层
|
||||
* (2022.06.24) 增加`Legend`对`Background`和`Padding`的支持
|
||||
* (2022.06.21) 增加`TextStyle`对`TextMeshPro`的`Sprite Asset`支持 (#201)
|
||||
|
||||
@@ -255,6 +255,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `RemoveSerie()` |public void RemoveSerie(Serie serie)</br> |
|
||||
| `RemoveSerie()` |public void RemoveSerie(string serieName)</br> |
|
||||
| `ReplaceSerie()` |public bool ReplaceSerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `ResetDataIndex()` |public bool ResetDataIndex(int serieIndex)</br>重置serie的数据项索引。避免数据项索引异常。 |
|
||||
| `SetBasePainterMaterial()` |public void SetBasePainterMaterial(Material material)</br>设置Base Painter的材质球 |
|
||||
| `SetMaxCache()` |public void SetMaxCache(int maxCache)</br>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 |
|
||||
| `SetPainterActive()` |public void SetPainterActive(int index, bool flag)</br> |
|
||||
|
||||
@@ -255,6 +255,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `RemoveSerie()` |public void RemoveSerie(Serie serie)</br> |
|
||||
| `RemoveSerie()` |public void RemoveSerie(string serieName)</br> |
|
||||
| `ReplaceSerie()` |public bool ReplaceSerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `ResetDataIndex()` |public bool ResetDataIndex(int serieIndex)</br>重置serie的数据项索引。避免数据项索引异常。 |
|
||||
| `SetBasePainterMaterial()` |public void SetBasePainterMaterial(Material material)</br>设置Base Painter的材质球 |
|
||||
| `SetMaxCache()` |public void SetMaxCache(int maxCache)</br>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 |
|
||||
| `SetPainterActive()` |public void SetPainterActive(int index, bool flag)</br> |
|
||||
|
||||
@@ -215,6 +215,7 @@ The style of area.
|
||||
|`color`|||the color of area,default use serie color.
|
||||
|`toColor`|||Gradient color, start color to toColor.
|
||||
|`opacity`|0.6f||Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0.
|
||||
|`fill`|true|v3.2.0|Whether to fill only polygonal areas. Currently, only convex polygons are supported.
|
||||
|
||||
## `ArrowStyle`
|
||||
|
||||
|
||||
@@ -215,6 +215,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
|`color`|||区域填充的颜色,如果toColor不是默认值,则表示渐变色的起点颜色。
|
||||
|`toColor`|||渐变色的终点颜色。
|
||||
|`opacity`|0.6f||图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|
||||
|`fill`|true|v3.2.0|是否只填充多边形区域。目前只支持凸多边形。
|
||||
|
||||
## `ArrowStyle`
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_ToColor");
|
||||
PropertyField(prop, "m_Opacity");
|
||||
PropertyField(prop, "m_InnerFill");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private Color32 m_Color;
|
||||
[SerializeField] private Color32 m_ToColor;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 0.6f;
|
||||
[SerializeField][Since("v3.2.0")] private bool m_InnerFill;
|
||||
|
||||
/// <summary>
|
||||
/// Set this to false to prevent the areafrom showing.
|
||||
@@ -83,6 +84,15 @@ namespace XCharts.Runtime
|
||||
get { return m_Opacity; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Opacity, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to fill only polygonal areas. Currently, only convex polygons are supported.
|
||||
/// |是否只填充多边形区域。目前只支持凸多边形。
|
||||
/// </summary>
|
||||
public bool innerFill
|
||||
{
|
||||
get { return m_InnerFill; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_InnerFill, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public Color32 GetColor()
|
||||
{
|
||||
|
||||
@@ -24,11 +24,17 @@ namespace XCharts.Runtime
|
||||
public static void DrawSerieLineArea(VertexHelper vh, Serie serie, Serie lastStackSerie,
|
||||
ThemeStyle theme, VisualMap visualMap, bool isY, Axis axis, Axis relativedAxis, GridCoord grid)
|
||||
{
|
||||
Color32 srcAreaColor, srcAreaToColor;
|
||||
if (!SerieHelper.GetAreaColor(out srcAreaColor, out srcAreaToColor, serie, null, theme, serie.context.colorIndex))
|
||||
Color32 areaColor, areaToColor;
|
||||
bool innerFill;
|
||||
if (!SerieHelper.GetAreaColor(out areaColor, out areaToColor, out innerFill, serie, null, theme, serie.context.colorIndex))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (innerFill)
|
||||
{
|
||||
UGL.DrawPolygon(vh, serie.context.dataPoints, areaColor);
|
||||
return;
|
||||
}
|
||||
var gridXY = (isY ? grid.context.x : grid.context.y);
|
||||
if (lastStackSerie == null)
|
||||
{
|
||||
@@ -36,8 +42,8 @@ namespace XCharts.Runtime
|
||||
gridXY + relativedAxis.context.offset,
|
||||
gridXY,
|
||||
gridXY + (isY ? grid.context.width : grid.context.height),
|
||||
srcAreaColor,
|
||||
srcAreaToColor,
|
||||
areaColor,
|
||||
areaToColor,
|
||||
visualMap,
|
||||
axis,
|
||||
relativedAxis,
|
||||
@@ -49,8 +55,8 @@ namespace XCharts.Runtime
|
||||
gridXY + relativedAxis.context.offset,
|
||||
gridXY,
|
||||
gridXY + (isY ? grid.context.width : grid.context.height),
|
||||
srcAreaColor,
|
||||
srcAreaToColor,
|
||||
areaColor,
|
||||
areaToColor,
|
||||
visualMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,15 +531,24 @@ namespace XCharts.Runtime
|
||||
|
||||
public static bool GetAreaColor(out Color32 color, out Color32 toColor,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, int index)
|
||||
{
|
||||
bool fill;
|
||||
return GetAreaColor(out color, out toColor, out fill,serie, serieData, theme, index);
|
||||
}
|
||||
|
||||
public static bool GetAreaColor(out Color32 color, out Color32 toColor, out bool innerFill,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, int index)
|
||||
{
|
||||
color = ChartConst.clearColor32;
|
||||
toColor = ChartConst.clearColor32;
|
||||
innerFill = false;
|
||||
var state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
{
|
||||
var areaStyle = GetAreaStyle(serie, serieData);
|
||||
if (areaStyle == null || !areaStyle.show) return false;
|
||||
innerFill = areaStyle.innerFill;
|
||||
GetColor(ref color, areaStyle.color, serie.itemStyle.color, areaStyle.opacity, theme, index);
|
||||
GetColor(ref toColor, areaStyle.toColor, color, areaStyle.opacity, theme, index);
|
||||
switch (state)
|
||||
@@ -564,6 +573,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (stateStyle.areaStyle.show)
|
||||
{
|
||||
innerFill = stateStyle.areaStyle.innerFill;
|
||||
GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index);
|
||||
GetColor(ref color, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user