增加单条堆叠柱状图

This commit is contained in:
monitor1394
2019-09-18 19:10:43 +08:00
parent 71b7691e90
commit 73bacfaceb
6 changed files with 11086 additions and 5767 deletions

View File

@@ -80,6 +80,7 @@ public class Demo : MonoBehaviour
{
InitModuleButton();
}
if (!Application.isPlaying) m_Mark.enabled = false;
#endif
}

File diff suppressed because it is too large Load Diff

View File

@@ -72,7 +72,7 @@ namespace XCharts
/ (xAxis.maxValue - xAxis.minValue) * coordinateWid;
seriesHig[i] += barHig;
float currHig = CheckAnimation(serie,i,barHig);
float currHig = CheckAnimation(serie, i, barHig);
Vector3 p1 = new Vector3(pX, pY + space + barWidth);
Vector3 p2 = new Vector3(pX + currHig, pY + space + barWidth);
@@ -158,7 +158,7 @@ namespace XCharts
/ (yAxis.maxValue - yAxis.minValue) * coordinateHig;
seriesHig[i] += barHig;
float currHig = CheckAnimation(serie,i,barHig);
float currHig = CheckAnimation(serie, i, barHig);
Vector3 p1 = new Vector3(pX + space, pY);
Vector3 p2 = new Vector3(pX + space, pY + currHig);

View File

@@ -387,7 +387,9 @@ namespace XCharts
public float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
{
int split = GetSplitNumber(coordinateWidth, dataZoom);
return coordinateWidth / (m_BoundaryGap ? split : split - 1);
int segment = (m_BoundaryGap ? split : split - 1);
segment = segment <= 0 ? 1 : segment;
return coordinateWidth / segment;
}
/// <summary>
@@ -409,7 +411,9 @@ namespace XCharts
public float GetDataWidth(float coordinateWidth, DataZoom dataZoom)
{
var dataCount = GetDataNumber(dataZoom);
return coordinateWidth / (m_BoundaryGap ? dataCount : dataCount - 1);
int segment = (m_BoundaryGap ? dataCount : dataCount - 1);
segment = segment <= 0 ? 1 : segment;
return coordinateWidth / segment;
}
private Dictionary<float, string> _cacheValue2str = new Dictionary<float, string>();

View File

@@ -1100,6 +1100,7 @@ namespace XCharts
var serie = m_Series.GetSerie(n);
if (!serie.show || serie.symbol.type == SerieSymbolType.None) continue;
var zeroPos = Vector3.zero;
var lastStackSerie = m_Series.GetLastStackSerie(n);
if (serie.type == SerieType.Bar)
{
if (serie.label.position == SerieLabel.Position.Bottom || serie.label.position == SerieLabel.Position.Center)
@@ -1128,14 +1129,16 @@ namespace XCharts
case SerieType.Line:
break;
case SerieType.Bar:
var bottomPos = lastStackSerie == null ? zeroPos : lastStackSerie.dataPoints[j];
switch (serie.label.position)
{
case SerieLabel.Position.Center:
pos = isYAxis ? new Vector3(zeroPos.x + (pos.x - zeroPos.x) / 2, pos.y) :
new Vector3(pos.x, zeroPos.y + (pos.y - zeroPos.y) / 2);
pos = isYAxis ? new Vector3(bottomPos.x + (pos.x - bottomPos.x) / 2, pos.y) :
new Vector3(pos.x, bottomPos.y + (pos.y - bottomPos.y) / 2);
break;
case SerieLabel.Position.Bottom:
pos = isYAxis ? new Vector3(zeroPos.x, pos.y) : new Vector3(pos.x, zeroPos.y);
pos = isYAxis ? new Vector3(bottomPos.x, pos.y) : new Vector3(pos.x, bottomPos.y);
break;
}
break;

View File

@@ -23,6 +23,7 @@ QQ交流群XCharts交流群202030963
## 更新日志
* 2019.09.18)增加单条堆叠柱状图
* 2019.09.18)增加虚线`Dash`、点线`Dot`、点划线`DashDot`、双点划线`DashDotDot`等类型的折线图支持
* 2019.09.17)增加`AnimationEnabel()`启用或取消起始动画接口
* 2019.09.17)增加`Axis``Interval`强制设置坐标轴分割间隔
@@ -121,6 +122,7 @@ QQ交流群XCharts交流群202030963
7. 深圳月最低生活费组成(单位:元)
8. 非堆叠同柱
9. 5000数据
10. 单条堆叠柱状图
### 饼图