* UILineChart: 简化了设置坐标轴范围的函数
This commit is contained in:
parent
b531ae0931
commit
1677fc631e
Binary file not shown.
Binary file not shown.
@ -64,9 +64,11 @@ namespace Sunny.UI.Demo
|
|||||||
option.YAxis.AxisLabel.DecimalCount = 1;
|
option.YAxis.AxisLabel.DecimalCount = 1;
|
||||||
option.YAxis.AxisLabel.AutoFormat = false;
|
option.YAxis.AxisLabel.AutoFormat = false;
|
||||||
|
|
||||||
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = dt.AddHours(3).DateTimeString(), Value = new DateTimeInt64(dt.AddHours(3)) });
|
option.XAxisScaleLines.Add(new UIScaleLine(dt.AddHours(3).DateTimeString(), dt.AddHours(3), Color.Red));
|
||||||
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = dt.AddHours(6).DateTimeString(), Value = new DateTimeInt64(dt.AddHours(6)) });
|
option.XAxisScaleLines.Add(new UIScaleLine(dt.AddHours(6).DateTimeString(), dt.AddHours(6), Color.Red));
|
||||||
|
|
||||||
|
//设置X轴显示范围
|
||||||
|
option.XAxis.SetRange(dt, dt.AddHours(8));
|
||||||
LineChart.SetOption(option);
|
LineChart.SetOption(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,6 +227,7 @@ namespace Sunny.UI.Demo
|
|||||||
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Lime, Name = "3", Value = 3 });
|
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Lime, Name = "3", Value = 3 });
|
||||||
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "6", Value = 6 });
|
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "6", Value = 6 });
|
||||||
|
|
||||||
|
//设置坐标轴为自定义标签
|
||||||
option.XAxis.CustomLabels = new CustomLabels(1, 1, 11);
|
option.XAxis.CustomLabels = new CustomLabels(1, 1, 11);
|
||||||
for (int i = 1; i <= 12; i++)
|
for (int i = 1; i <= 12; i++)
|
||||||
{
|
{
|
||||||
|
@ -168,6 +168,42 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
get => CustomLabels != null && CustomLabels.Count > 0;
|
get => CustomLabels != null && CustomLabels.Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetMinValue(double min)
|
||||||
|
{
|
||||||
|
Min = min;
|
||||||
|
MinAuto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMaxValue(double max)
|
||||||
|
{
|
||||||
|
Max = max;
|
||||||
|
MaxAuto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRange(double min, double max)
|
||||||
|
{
|
||||||
|
SetMinValue(min);
|
||||||
|
SetMaxValue(max);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMinValue(DateTime min)
|
||||||
|
{
|
||||||
|
Min = new DateTimeInt64(min);
|
||||||
|
MinAuto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMaxValue(DateTime max)
|
||||||
|
{
|
||||||
|
Max = new DateTimeInt64(max);
|
||||||
|
MaxAuto = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRange(DateTime min, DateTime max)
|
||||||
|
{
|
||||||
|
SetMinValue(min);
|
||||||
|
SetMaxValue(max);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CustomLabels
|
public class CustomLabels
|
||||||
|
Loading…
x
Reference in New Issue
Block a user