mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
增加AreaStyle的toTop参数可设置折线图渐变色是到顶部还是到实际位置
This commit is contained in:
@@ -24,22 +24,21 @@ slug: /api
|
||||
|[ListForSerie](#listforserie)|[MainComponentContext](#maincomponentcontext)|[MainComponentHandler](#maincomponenthandler)|
|
||||
|[MainComponentHandler<T>](#maincomponenthandlert)|[MathUtil](#mathutil)|[Painter](#painter)|
|
||||
|[ParallelChart](#parallelchart)|[ParallelCoordContext](#parallelcoordcontext)|[PieChart](#piechart)|
|
||||
|[PolarChart](#polarchart)|[PolarCoordContext](#polarcoordcontext)|[ProgressBar](#progressbar)|
|
||||
|[PropertyUtil](#propertyutil)|[RadarChart](#radarchart)|[RadarCoordContext](#radarcoordcontext)|
|
||||
|[ReflectionUtil](#reflectionutil)|[RequireChartComponentAttribute](#requirechartcomponentattribute)|[RingChart](#ringchart)|
|
||||
|[RuntimeUtil](#runtimeutil)|[ScatterChart](#scatterchart)|[SerieContext](#seriecontext)|
|
||||
|[SerieConvertAttribute](#serieconvertattribute)|[SerieDataContext](#seriedatacontext)|[SerieDataExtraComponentAttribute](#seriedataextracomponentattribute)|
|
||||
|[SerieDataExtraFieldAttribute](#seriedataextrafieldattribute)|[SerieExtraComponentAttribute](#serieextracomponentattribute)|[SerieHandler](#seriehandler)|
|
||||
|[SerieHandler<T>](#seriehandlert)|[SerieHandlerAttribute](#seriehandlerattribute)|[SerieHelper](#seriehelper)|
|
||||
|[SerieLabelHelper](#serielabelhelper)|[SerieLabelPool](#serielabelpool)|[SerieParams](#serieparams)|
|
||||
|[SeriesHelper](#serieshelper)|[SimplifiedBarChart](#simplifiedbarchart)|[SimplifiedCandlestickChart](#simplifiedcandlestickchart)|
|
||||
|[SimplifiedLineChart](#simplifiedlinechart)|[Since](#since)|[SVG](#svg)|
|
||||
|[SVGImage](#svgimage)|[SVGPath](#svgpath)|[SVGPathSeg](#svgpathseg)|
|
||||
|[TooltipContext](#tooltipcontext)|[TooltipData](#tooltipdata)|[TooltipHelper](#tooltiphelper)|
|
||||
|[TooltipView](#tooltipview)|[TooltipViewItem](#tooltipviewitem)|[UGL](#ugl)|
|
||||
|[UGLExample](#uglexample)|[UGLHelper](#uglhelper)|[VisualMapContext](#visualmapcontext)|
|
||||
|[VisualMapHelper](#visualmaphelper)|[XChartsMgr](#xchartsmgr)|[XCResourceImporterWindow](#xcresourceimporterwindow)|
|
||||
|[XCThemeMgr](#xcthememgr)|
|
||||
|[PolarChart](#polarchart)|[PolarCoordContext](#polarcoordcontext)|[PropertyUtil](#propertyutil)|
|
||||
|[RadarChart](#radarchart)|[RadarCoordContext](#radarcoordcontext)|[ReflectionUtil](#reflectionutil)|
|
||||
|[RequireChartComponentAttribute](#requirechartcomponentattribute)|[RingChart](#ringchart)|[RuntimeUtil](#runtimeutil)|
|
||||
|[ScatterChart](#scatterchart)|[SerieContext](#seriecontext)|[SerieConvertAttribute](#serieconvertattribute)|
|
||||
|[SerieDataContext](#seriedatacontext)|[SerieDataExtraComponentAttribute](#seriedataextracomponentattribute)|[SerieDataExtraFieldAttribute](#seriedataextrafieldattribute)|
|
||||
|[SerieExtraComponentAttribute](#serieextracomponentattribute)|[SerieHandler](#seriehandler)|[SerieHandler<T>](#seriehandlert)|
|
||||
|[SerieHandlerAttribute](#seriehandlerattribute)|[SerieHelper](#seriehelper)|[SerieLabelHelper](#serielabelhelper)|
|
||||
|[SerieLabelPool](#serielabelpool)|[SerieParams](#serieparams)|[SeriesHelper](#serieshelper)|
|
||||
|[SimplifiedBarChart](#simplifiedbarchart)|[SimplifiedCandlestickChart](#simplifiedcandlestickchart)|[SimplifiedLineChart](#simplifiedlinechart)|
|
||||
|[Since](#since)|[SVG](#svg)|[SVGImage](#svgimage)|
|
||||
|[SVGPath](#svgpath)|[SVGPathSeg](#svgpathseg)|[TooltipContext](#tooltipcontext)|
|
||||
|[TooltipData](#tooltipdata)|[TooltipHelper](#tooltiphelper)|[TooltipView](#tooltipview)|
|
||||
|[TooltipViewItem](#tooltipviewitem)|[UGL](#ugl)|[UGLExample](#uglexample)|
|
||||
|[UGLHelper](#uglhelper)|[VisualMapContext](#visualmapcontext)|[VisualMapHelper](#visualmaphelper)|
|
||||
|[XChartsMgr](#xchartsmgr)|[XCResourceImporterWindow](#xcresourceimporterwindow)|[XCThemeMgr](#xcthememgr)|
|
||||
|
||||
## AnimationStyleHelper
|
||||
|
||||
@@ -670,10 +669,6 @@ Inherits or Implemented: [BaseChart](#basechart)
|
||||
|
||||
Inherits or Implemented: [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
## ProgressBar
|
||||
|
||||
Inherits or Implemented: [BaseChart](#basechart)
|
||||
|
||||
## PropertyUtil
|
||||
|
||||
|public method|description|
|
||||
|
||||
@@ -128,6 +128,7 @@ The style of area.
|
||||
|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.
|
||||
|innerFill||v3.2.0|Whether to fill only polygonal areas. Currently, only convex polygons are supported.
|
||||
|toTop|true|v3.6.0|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.
|
||||
|
||||
## ArrowStyle
|
||||
|
||||
|
||||
@@ -24,22 +24,21 @@ slug: /api
|
||||
|[ListForSerie](#listforserie)|[MainComponentContext](#maincomponentcontext)|[MainComponentHandler](#maincomponenthandler)|
|
||||
|[MainComponentHandler<T>](#maincomponenthandlert)|[MathUtil](#mathutil)|[Painter](#painter)|
|
||||
|[ParallelChart](#parallelchart)|[ParallelCoordContext](#parallelcoordcontext)|[PieChart](#piechart)|
|
||||
|[PolarChart](#polarchart)|[PolarCoordContext](#polarcoordcontext)|[ProgressBar](#progressbar)|
|
||||
|[PropertyUtil](#propertyutil)|[RadarChart](#radarchart)|[RadarCoordContext](#radarcoordcontext)|
|
||||
|[ReflectionUtil](#reflectionutil)|[RequireChartComponentAttribute](#requirechartcomponentattribute)|[RingChart](#ringchart)|
|
||||
|[RuntimeUtil](#runtimeutil)|[ScatterChart](#scatterchart)|[SerieContext](#seriecontext)|
|
||||
|[SerieConvertAttribute](#serieconvertattribute)|[SerieDataContext](#seriedatacontext)|[SerieDataExtraComponentAttribute](#seriedataextracomponentattribute)|
|
||||
|[SerieDataExtraFieldAttribute](#seriedataextrafieldattribute)|[SerieExtraComponentAttribute](#serieextracomponentattribute)|[SerieHandler](#seriehandler)|
|
||||
|[SerieHandler<T>](#seriehandlert)|[SerieHandlerAttribute](#seriehandlerattribute)|[SerieHelper](#seriehelper)|
|
||||
|[SerieLabelHelper](#serielabelhelper)|[SerieLabelPool](#serielabelpool)|[SerieParams](#serieparams)|
|
||||
|[SeriesHelper](#serieshelper)|[SimplifiedBarChart](#simplifiedbarchart)|[SimplifiedCandlestickChart](#simplifiedcandlestickchart)|
|
||||
|[SimplifiedLineChart](#simplifiedlinechart)|[Since](#since)|[SVG](#svg)|
|
||||
|[SVGImage](#svgimage)|[SVGPath](#svgpath)|[SVGPathSeg](#svgpathseg)|
|
||||
|[TooltipContext](#tooltipcontext)|[TooltipData](#tooltipdata)|[TooltipHelper](#tooltiphelper)|
|
||||
|[TooltipView](#tooltipview)|[TooltipViewItem](#tooltipviewitem)|[UGL](#ugl)|
|
||||
|[UGLExample](#uglexample)|[UGLHelper](#uglhelper)|[VisualMapContext](#visualmapcontext)|
|
||||
|[VisualMapHelper](#visualmaphelper)|[XChartsMgr](#xchartsmgr)|[XCResourceImporterWindow](#xcresourceimporterwindow)|
|
||||
|[XCThemeMgr](#xcthememgr)|
|
||||
|[PolarChart](#polarchart)|[PolarCoordContext](#polarcoordcontext)|[PropertyUtil](#propertyutil)|
|
||||
|[RadarChart](#radarchart)|[RadarCoordContext](#radarcoordcontext)|[ReflectionUtil](#reflectionutil)|
|
||||
|[RequireChartComponentAttribute](#requirechartcomponentattribute)|[RingChart](#ringchart)|[RuntimeUtil](#runtimeutil)|
|
||||
|[ScatterChart](#scatterchart)|[SerieContext](#seriecontext)|[SerieConvertAttribute](#serieconvertattribute)|
|
||||
|[SerieDataContext](#seriedatacontext)|[SerieDataExtraComponentAttribute](#seriedataextracomponentattribute)|[SerieDataExtraFieldAttribute](#seriedataextrafieldattribute)|
|
||||
|[SerieExtraComponentAttribute](#serieextracomponentattribute)|[SerieHandler](#seriehandler)|[SerieHandler<T>](#seriehandlert)|
|
||||
|[SerieHandlerAttribute](#seriehandlerattribute)|[SerieHelper](#seriehelper)|[SerieLabelHelper](#serielabelhelper)|
|
||||
|[SerieLabelPool](#serielabelpool)|[SerieParams](#serieparams)|[SeriesHelper](#serieshelper)|
|
||||
|[SimplifiedBarChart](#simplifiedbarchart)|[SimplifiedCandlestickChart](#simplifiedcandlestickchart)|[SimplifiedLineChart](#simplifiedlinechart)|
|
||||
|[Since](#since)|[SVG](#svg)|[SVGImage](#svgimage)|
|
||||
|[SVGPath](#svgpath)|[SVGPathSeg](#svgpathseg)|[TooltipContext](#tooltipcontext)|
|
||||
|[TooltipData](#tooltipdata)|[TooltipHelper](#tooltiphelper)|[TooltipView](#tooltipview)|
|
||||
|[TooltipViewItem](#tooltipviewitem)|[UGL](#ugl)|[UGLExample](#uglexample)|
|
||||
|[UGLHelper](#uglhelper)|[VisualMapContext](#visualmapcontext)|[VisualMapHelper](#visualmaphelper)|
|
||||
|[XChartsMgr](#xchartsmgr)|[XCResourceImporterWindow](#xcresourceimporterwindow)|[XCThemeMgr](#xcthememgr)|
|
||||
|
||||
## AnimationStyleHelper
|
||||
|
||||
@@ -670,10 +669,6 @@ Inherits or Implemented: [BaseChart](#basechart)
|
||||
|
||||
Inherits or Implemented: [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
## ProgressBar
|
||||
|
||||
Inherits or Implemented: [BaseChart](#basechart)
|
||||
|
||||
## PropertyUtil
|
||||
|
||||
|public method|description|
|
||||
|
||||
@@ -65,6 +65,9 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
* (2022.12.08) 增加`AreaStyle`的`toTop`参数可设置折线图渐变色是到顶部还是到实际位置
|
||||
* (2022.12.07) 增加`Formatter`的文本通配符`{h}`支持设置当前颜色值
|
||||
|
||||
## v3.5.0
|
||||
|
||||
版本要点:
|
||||
|
||||
@@ -128,6 +128,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent
|
||||
|toColor|||渐变色的终点颜色。
|
||||
|opacity|0.6f||图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|
||||
|innerFill||v3.2.0|是否只填充多边形区域。目前只支持凸多边形。
|
||||
|toTop|true|v3.6.0|渐变色是到顶部还是到实际位置。默认为true到顶部。
|
||||
|
||||
## ArrowStyle
|
||||
|
||||
@@ -1364,7 +1365,7 @@ Inherits or Implemented: [MainComponent](#maincomponent)
|
||||
|trigger|||触发类型。<br/>`Tooltip.Trigger`:<br/>- `Item`: 数据项图形触发,主要在散点图,饼图等无类目轴的图表中使用。<br/>- `Axis`: 坐标轴触发,主要在柱状图,折线图等会使用类目轴的图表中使用。<br/>- `None`: 什么都不触发。<br/>|
|
||||
|position||v3.3.0|显示位置类型。<br/>`Tooltip.Position`:<br/>- `Auto`: 自适应。移动平台靠顶部显示,非移动平台跟随鼠标位置。<br/>- `Custom`: 自定义。完全自定义显示位置(x,y)。<br/>- `FixedX`: 只固定坐标X。Y跟随鼠标位置。<br/>- `FixedY`: <br/>|
|
||||
|itemFormatter|||提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用
|
||||
|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。<br/> {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。<br/> {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|
||||
|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。<br/> {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。<br/> {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|
||||
|marker|||serie的符号标志。
|
||||
|fixedWidth|0||固定宽度。比 minWidth 优先。
|
||||
|fixedHeight|0||固定高度。比 minHeight 优先。
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_ToColor");
|
||||
PropertyField(prop, "m_Opacity");
|
||||
PropertyField(prop, "m_ToTop");
|
||||
PropertyField(prop, "m_InnerFill");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private Color32 m_ToColor;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 0.6f;
|
||||
[SerializeField][Since("v3.2.0")] private bool m_InnerFill;
|
||||
[SerializeField][Since("v3.6.0")] private bool m_ToTop = true;
|
||||
|
||||
/// <summary>
|
||||
/// Set this to false to prevent the areafrom showing.
|
||||
@@ -93,6 +94,16 @@ namespace XCharts.Runtime
|
||||
get { return m_InnerFill; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_InnerFill, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <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到顶部。
|
||||
/// </summary>
|
||||
public bool toTop
|
||||
{
|
||||
get { return m_ToTop; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ToTop, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public Color32 GetColor()
|
||||
{
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace XCharts.Runtime
|
||||
ThemeStyle theme, VisualMap visualMap, bool isY, Axis axis, Axis relativedAxis, GridCoord grid)
|
||||
{
|
||||
Color32 areaColor, areaToColor;
|
||||
bool innerFill;
|
||||
if (!SerieHelper.GetAreaColor(out areaColor, out areaToColor, out innerFill, serie, null, theme, serie.context.colorIndex))
|
||||
bool innerFill, toTop;
|
||||
if (!SerieHelper.GetAreaColor(out areaColor, out areaToColor, out innerFill, out toTop, serie, null, theme, serie.context.colorIndex))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -47,7 +47,8 @@ namespace XCharts.Runtime
|
||||
visualMap,
|
||||
axis,
|
||||
relativedAxis,
|
||||
grid);
|
||||
grid,
|
||||
toTop);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -57,13 +58,14 @@ namespace XCharts.Runtime
|
||||
gridXY + (isY ? grid.context.width : grid.context.height),
|
||||
areaColor,
|
||||
areaToColor,
|
||||
visualMap);
|
||||
visualMap,
|
||||
toTop);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawSerieLineNormalArea(VertexHelper vh, Serie serie, bool isY,
|
||||
float zero, float min, float max, Color32 areaColor, Color32 areaToColor,
|
||||
VisualMap visualMap, Axis axis, Axis relativedAxis, GridCoord grid)
|
||||
VisualMap visualMap, Axis axis, Axis relativedAxis, GridCoord grid, bool toTop)
|
||||
{
|
||||
var points = serie.context.drawPoints;
|
||||
var count = points.Count;
|
||||
@@ -117,7 +119,7 @@ namespace XCharts.Runtime
|
||||
if (UGLHelper.GetIntersection(lp, tp, zsp, zep, ref ip))
|
||||
{
|
||||
if (lerp)
|
||||
AddVertToVertexHelperWithLerpColor(vh, ip, ip, color, toColor, isY, min, max, i > 0);
|
||||
AddVertToVertexHelperWithLerpColor(vh, ip, ip, color, toColor, isY, min, max, i > 0, toTop);
|
||||
else
|
||||
{
|
||||
if (lastDataIsIgnore)
|
||||
@@ -133,7 +135,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
if (lerp)
|
||||
AddVertToVertexHelperWithLerpColor(vh, tp, zp, color, toColor, isY, min, max, i > 0);
|
||||
AddVertToVertexHelperWithLerpColor(vh, tp, zp, color, toColor, isY, min, max, i > 0, toTop);
|
||||
else
|
||||
{
|
||||
if (lastDataIsIgnore)
|
||||
@@ -152,7 +154,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
private static void DrawSerieLineStackArea(VertexHelper vh, Serie serie, Serie lastStackSerie, bool isY,
|
||||
float zero, float min, float max, Color32 color, Color32 toColor, VisualMap visualMap)
|
||||
float zero, float min, float max, Color32 color, Color32 toColor, VisualMap visualMap, bool toTop)
|
||||
{
|
||||
if (lastStackSerie == null)
|
||||
return;
|
||||
@@ -170,7 +172,7 @@ namespace XCharts.Runtime
|
||||
var lbp = downPoints[0].position;
|
||||
|
||||
if (lerp)
|
||||
AddVertToVertexHelperWithLerpColor(vh, ltp, lbp, color, toColor, isY, min, max, false);
|
||||
AddVertToVertexHelperWithLerpColor(vh, ltp, lbp, color, toColor, isY, min, max, false, toTop);
|
||||
else
|
||||
UGL.AddVertToVertexHelper(vh, ltp, lbp, color, false);
|
||||
|
||||
@@ -216,7 +218,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
if (lerp)
|
||||
AddVertToVertexHelperWithLerpColor(vh, tp, bp, color, toColor, isY, min, max, true);
|
||||
AddVertToVertexHelperWithLerpColor(vh, tp, bp, color, toColor, isY, min, max, true, toTop);
|
||||
else
|
||||
UGL.AddVertToVertexHelper(vh, tp, bp, color, true);
|
||||
u++;
|
||||
@@ -234,12 +236,20 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
private static void AddVertToVertexHelperWithLerpColor(VertexHelper vh, Vector3 tp, Vector3 bp,
|
||||
Color32 color, Color32 toColor, bool isY, float min, float max, bool needTriangle)
|
||||
Color32 color, Color32 toColor, bool isY, float min, float max, bool needTriangle, bool toTop)
|
||||
{
|
||||
var range = max - min;
|
||||
var color1 = Color32.Lerp(color, toColor, ((isY ? tp.x : tp.y) - min) / range);
|
||||
var color2 = Color32.Lerp(color, toColor, ((isY ? bp.x : bp.y) - min) / range);
|
||||
UGL.AddVertToVertexHelper(vh, tp, bp, color1, color2, needTriangle);
|
||||
if (toTop)
|
||||
{
|
||||
var range = max - min;
|
||||
var color1 = Color32.Lerp(color, toColor, ((isY ? tp.x : tp.y) - min) / range);
|
||||
var color2 = Color32.Lerp(color, toColor, ((isY ? bp.x : bp.y) - min) / range);
|
||||
|
||||
UGL.AddVertToVertexHelper(vh, tp, bp, color1, color2, needTriangle);
|
||||
}
|
||||
else
|
||||
{
|
||||
UGL.AddVertToVertexHelper(vh, tp, bp, toColor, color, needTriangle);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void DrawSerieLine(VertexHelper vh, ThemeStyle theme, Serie serie, VisualMap visualMap,
|
||||
|
||||
@@ -542,16 +542,17 @@ 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);
|
||||
bool fill, toTop;
|
||||
return GetAreaColor(out color, out toColor, out fill, out toTop, 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)
|
||||
out bool toTop, Serie serie, SerieData serieData, ThemeStyle theme, int index)
|
||||
{
|
||||
color = ChartConst.clearColor32;
|
||||
toColor = ChartConst.clearColor32;
|
||||
innerFill = false;
|
||||
toTop = true;
|
||||
var state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
@@ -559,6 +560,7 @@ namespace XCharts.Runtime
|
||||
var areaStyle = GetAreaStyle(serie, serieData);
|
||||
if (areaStyle == null || !areaStyle.show) return false;
|
||||
innerFill = areaStyle.innerFill;
|
||||
toTop = areaStyle.toTop;
|
||||
GetColor(ref color, areaStyle.color, serie.itemStyle.color, areaStyle.opacity, theme, index);
|
||||
GetColor(ref toColor, areaStyle.toColor, color, areaStyle.opacity, theme, index);
|
||||
switch (state)
|
||||
@@ -584,6 +586,7 @@ namespace XCharts.Runtime
|
||||
if (stateStyle.areaStyle.show)
|
||||
{
|
||||
innerFill = stateStyle.areaStyle.innerFill;
|
||||
toTop = stateStyle.areaStyle.toTop;
|
||||
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