diff --git a/Assets/XCharts/Scripts/UI/Component/Serie.cs b/Assets/XCharts/Scripts/UI/Component/Serie.cs
index 6110dc20..c5501839 100644
--- a/Assets/XCharts/Scripts/UI/Component/Serie.cs
+++ b/Assets/XCharts/Scripts/UI/Component/Serie.cs
@@ -73,11 +73,16 @@ namespace XCharts
///
Normal,
///
- /// the normal line chart,
+ /// the smooth line chart,
/// 平滑曲线。
///
Smooth,
///
+ /// the smooth-dash line chart,
+ /// 平滑虚线。
+ ///
+ SmoothDash,
+ ///
/// step line.
/// 阶梯线图:当前点。
///
diff --git a/Assets/XCharts/Scripts/UI/Internal/CoordinateChart_DrawLine.cs b/Assets/XCharts/Scripts/UI/Internal/CoordinateChart_DrawLine.cs
index a373d6f9..9bd4d10d 100644
--- a/Assets/XCharts/Scripts/UI/Internal/CoordinateChart_DrawLine.cs
+++ b/Assets/XCharts/Scripts/UI/Internal/CoordinateChart_DrawLine.cs
@@ -1,5 +1,4 @@
-
using System;
using System.Collections.Generic;
using UnityEngine;
@@ -131,6 +130,29 @@ namespace XCharts
float currDetailProgress = lp.x;
float totalDetailProgress = serie.dataPoints[dataCount - 1].x;
serie.animation.InitProgress(dataCount, currDetailProgress, totalDetailProgress);
+
+ Vector3 firstLastPos = Vector3.zero, lastNextPos = Vector3.zero;
+ if (serie.minShow > 0 && serie.minShow < showData.Count)
+ {
+ i = serie.minShow - 1;
+ float yValue = showData[i].data[1];
+ GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, 0, ref firstLastPos);
+ }
+ else
+ {
+ firstLastPos = lp;
+ }
+ if (serie.maxShow > 0 && serie.maxShow < showData.Count)
+ {
+ i = serie.maxShow;
+ float yValue = showData[i].data[1];
+ GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, 0, ref lastNextPos);
+ }
+ else
+ {
+ lastNextPos = serie.dataPoints[serie.dataPoints.Count - 1];
+ }
+
for (i = 1; i < serie.dataPoints.Count; i++)
{
np = serie.dataPoints[i];
@@ -145,8 +167,9 @@ namespace XCharts
areaColor, areaToColor, zeroPos);
break;
case LineType.Smooth:
- llp = i > 1 ? serie.dataPoints[i - 2] : lp;
- nnp = i < serie.dataPoints.Count - 1 ? serie.dataPoints[i + 1] : np;
+ case LineType.SmoothDash:
+ llp = i > 1 ? serie.dataPoints[i - 2] : firstLastPos;
+ nnp = i < serie.dataPoints.Count - 1 ? serie.dataPoints[i + 1] : lastNextPos;
isFinish = DrawSmoothLine(vh, serieIndex, serie, xAxis, lp, np, llp, nnp, i,
lineColor, areaColor, areaToColor, isStack, zeroPos);
break;
@@ -401,6 +424,7 @@ namespace XCharts
areaColor, areaToColor, zeroPos);
break;
case LineType.Smooth:
+ case LineType.SmoothDash:
llp = i > 1 ? serie.dataPoints[i - 2] : lp;
nnp = i < serie.dataPoints.Count - 1 ? serie.dataPoints[i + 1] : np;
isFinish = DrawSmoothLine(vh, serieIndex, serie, yAxis, lp, np, llp, nnp, i,
@@ -844,6 +868,16 @@ namespace XCharts
else ChartHelper.GetBezierList(ref bezierPoints, vh, lp, np, llp, nnp, fine, lineSmoothStyle);
Vector3 start, to;
+ if (serie.lineType == LineType.SmoothDash)
+ {
+ for (int i = 0; i < bezierPoints.Count - 2; i += 2)
+ {
+ start = bezierPoints[i];
+ to = bezierPoints[i + 1];
+ ChartHelper.DrawLine(vh, start, to, lineWidth, lineColor);
+ }
+ return true;
+ }
start = bezierPoints[0];
var dir = bezierPoints[1] - start;
diff --git a/Assets/XCharts/Scripts/UI/Utility/ChartHelper.cs b/Assets/XCharts/Scripts/UI/Utility/ChartHelper.cs
index 2bbaef34..d74c052e 100644
--- a/Assets/XCharts/Scripts/UI/Utility/ChartHelper.cs
+++ b/Assets/XCharts/Scripts/UI/Utility/ChartHelper.cs
@@ -522,7 +522,8 @@ namespace XCharts
}
if (nep == ep) cp2 = ep;
else cp2 = ep - (nep - sp).normalized * diff;
- int segment = (int)(dist / (fine ? 3f : 7f));
+ dist = Vector3.Distance(sp, ep);
+ int segment = (int)(dist / (fine ? 2f : 6f));
if (segment < 1) segment = (int)(dist / 0.5f);
if (segment < 4) segment = 4;
GetBezierList2(ref posList, sp, ep, segment, cp1, cp2);
diff --git a/Doc/XCharts配置项手册.md b/Doc/XCharts配置项手册.md
index e7142144..d6888fab 100644
--- a/Doc/XCharts配置项手册.md
+++ b/Doc/XCharts配置项手册.md
@@ -335,9 +335,10 @@
* `startIndex`:开始显示图形标记的索引。
* `interval`:显示图形标记的间隔。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。
* `forceShowLast`:是否强制显示最后一个图形标记。默认为 `false`。
-* `lineType`:折线图样式类型。支持以下九种类型:
+* `lineType`:折线图样式类型。支持以下十种类型:
* `Normal`:普通折线图。
* `Smooth`:平滑曲线。
+ * `SmoothDash`:平滑虚线。
* `StepStart`:阶梯线图:当前点。
* `StepMiddle`:阶梯线图:当前点和下一个点的中间。
* `StepEnd`:阶梯线图:下一个拐点。
diff --git a/README.md b/README.md
index 09e27c65..b998ee55 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,8 @@ QQ交流群:XCharts交流群(202030963)
## 更新日志
-* (2019.09.29)增加`Serie`采样类型`sampleType`的相关配置
+* (2019.10.01)增加`SmoothDash`平滑虚线的支持
+* (2019.09.30)增加`Serie`采样类型`sampleType`的相关配置
* (2019.09.29)增加`SerieSymbol`关于显示间隔的相关配置
* (2019.09.29)重构代码:
1. `BaseChart`的`sampleDist`删除,`Serie`增加`lineSampleDist`