Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教XField是datetime类型,有时分秒,应如何显示? #93

Open
zhuce2022 opened this issue Nov 8, 2022 · 5 comments
Open

Comments

@zhuce2022
Copy link

zhuce2022 commented Nov 8, 2022

数据示例:
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" />

页面上始终不显示图表,请问是日期时间类型的数据不支持吗?应如何处理呢?谢谢

@dkosinskyi
Copy link

Show what an array of objects looks like

@zhuce2022
Copy link
Author

    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

@dkosinskyi
Copy link

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"
       };

@zhuce2022
Copy link
Author

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.

@dkosinskyi
Copy link

great, bug fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants