mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-19 06:50:18 +00:00
优化Axis为Time时间轴时的分割效果
This commit is contained in:
@@ -128,8 +128,9 @@ namespace XCharts.Runtime
|
||||
if (range >= ONE_YEAR * MIN_TIME_SPLIT_NUMBER)
|
||||
{
|
||||
var num = splitNumber <= 0 ? GetSplitNumber(range, ONE_YEAR) : Math.Max(range / (splitNumber * ONE_YEAR), 1);
|
||||
var dtStart = (firstValue == 0 || secondValue == 0) ? new DateTime(dtMin.Year + 1, 1, 1) :
|
||||
(minTimestamp > firstValue ? DateTimeUtil.GetDateTime(secondValue) : DateTimeUtil.GetDateTime(firstValue));
|
||||
var dtStart = (firstValue == 0 || secondValue == 0 || (minTimestamp > firstValue && minTimestamp > secondValue))
|
||||
? (new DateTime(dtMin.Year, dtMin.Month, 1).AddMonths(1))
|
||||
: (minTimestamp > firstValue ? DateTimeUtil.GetDateTime(secondValue) : DateTimeUtil.GetDateTime(firstValue));
|
||||
tick = num * 365 * 24 * 3600;
|
||||
while (dtStart.Ticks < dtMax.Ticks)
|
||||
{
|
||||
@@ -140,8 +141,9 @@ namespace XCharts.Runtime
|
||||
else if (range >= ONE_MONTH * MIN_TIME_SPLIT_NUMBER)
|
||||
{
|
||||
var num = splitNumber <= 0 ? GetSplitNumber(range, ONE_MONTH) : Math.Max(range / (splitNumber * ONE_MONTH), 1);
|
||||
var dtStart = (firstValue == 0 || secondValue == 0) ? (new DateTime(dtMin.Year, dtMin.Month, 1).AddMonths(1)) :
|
||||
(minTimestamp > firstValue ? DateTimeUtil.GetDateTime(secondValue) : DateTimeUtil.GetDateTime(firstValue));
|
||||
var dtStart = (firstValue == 0 || secondValue == 0 || (minTimestamp > firstValue && minTimestamp > secondValue))
|
||||
? (new DateTime(dtMin.Year, dtMin.Month, 1).AddMonths(1))
|
||||
: (minTimestamp > firstValue ? DateTimeUtil.GetDateTime(secondValue) : DateTimeUtil.GetDateTime(firstValue));
|
||||
tick = num * 30 * 24 * 3600;
|
||||
while (dtStart.Ticks < dtMax.Ticks)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user