【问题标题】:Range bar chart in ng2-chartsng2-charts 中的范围条形图
【发布时间】:2020-12-10 14:39:45
【问题描述】:

我需要为每周数据实现条形图,如下图所示。 x 轴标签将是第 1 周、第 2 周、第 3 周等和每一天的条形图。我只想要简单的条形图,每周分隔,不需要花哨的颜色或类似下图的任何东西。

在ng2-chartsbar chart documnetation,我每年看到 2 个酒吧。那么我怎样才能每周实现多个酒吧

【问题讨论】:

    标签: angular ng2-charts


    【解决方案1】:

    不知何故,我能够通过更新文档中提到的示例来实现该功能。

    我希望所有条的颜色都相同,所以重复相同的颜色。不知道如何一次性通过

      public barChartColors2: Color[] = [
        { backgroundColor: '#35A4E8' },
        { backgroundColor: '#35A4E8' },
        { backgroundColor: '#35A4E8' },
        { backgroundColor: '#35A4E8' },
        { backgroundColor: '#35A4E8' },
        { backgroundColor: '#35A4E8' },
        { backgroundColor: '#35A4E8' }
        ];  
    
        public barChartData: ChartDataSets[] = [
        { data: [23, 42, 23, 54], label: 'Sunday', stack:'a' },
        { data: [91, 22, 53, 84], label: 'Monday' },
        { data: [51, 62, 23, 47], label: 'Tuesday' },
        { data: [71, 26, 53, 24], label: 'Wednesday' },
        { data: [51, 72, 33, 94], label: 'Thursday' },
        { data: [11, 32, 43, 54], label: 'Friday' },
        { data: [21, 42, 43, 44], label: 'Saturday' } 
        ];
    

    Stackbliz working demo

    【讨论】:

      猜你喜欢
      • 2021-04-25
      • 1970-01-01
      • 1970-01-01
      • 2017-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-02
      • 2019-04-02
      相关资源
      最近更新 更多