ant-design-charts-blazor
ant-design-charts-blazor copied to clipboard
请教XField是datetime类型,有时分秒,应如何显示?
数据示例: datetime:{2019-05-13 14:00:00 , 2019-05-13 14:30:00 , 2019-05-13 15:00:00} value:{111,222,333}
配置文件这样写:
LineConfig config = new LineConfig()
{
Title = new AntDesign.Charts.Title()
{
Visible = true,
Text = "曲线折线图",
},
Description = new AntDesign.Charts.Description()
{
Visible = true,
Text = "用平滑的曲线代替折线。",
},
Padding = "auto",
ForceFit = true,
XField = "datetime",
YField = "value"
};
<Line @ref="@chart5" Data="data" Config="config" />
页面上始终不显示图表,请问是日期时间类型的数据不支持吗?应如何处理呢?谢谢
Show what an array of objects looks like
List<object> dataList(List<BarEquity> bar)
{
List<object> t1 = new List<object>();
for (var i = 0; i < bar.Count; i++)
{
object t2 = new { Bardate = bar[i].datetime.ToString(), balance = bar[i].value };
t1.Add(t2);
}
return t1;
}
Show what an array of objects looks like
Try this
LineConfig config = new LineConfig()
{
Title = new AntDesign.Charts.Title()
{
Visible = true,
Text = "曲线折线图",
},
Description = new AntDesign.Charts.Description()
{
Visible = true,
Text = "用平滑的曲线代替折线。",
},
Padding = "auto",
ForceFit = true,
XField = "Bardate",
YField = "balance"
};
Try this
LineConfig config = new LineConfig() { Title = new AntDesign.Charts.Title() { Visible = true, Text = "曲线折线图", }, Description = new AntDesign.Charts.Description() { Visible = true, Text = "用平滑的曲线代替折线。", }, Padding = "auto", ForceFit = true, XField = "Bardate", YField = "balance" };
噢,这太尴尬了,第一次我是为了避免产生歧义,代替了bardate和balance,实际代码里面是您这样写的。
Oh, this is too embarrassing. For the first time, I replaced bardate and balance to avoid ambiguity. You wrote the actual code like this.
great, bug fixed?