【问题标题】:chart resizing in ng2-google-charts在 ng2-google-charts 中调整图表大小
【发布时间】:2019-02-21 07:28:29
【问题描述】:

我使用此文档 https://www.npmjs.com/package/ng2-google-charts 创建了一个图表。

<google-chart style="height: 100%!important; width: 80%!important;" [data]="pieChartData"></google-chart>

对于大屏幕来说,它显得非常小。无论如何我可以调整它的大小以适应大屏幕吗?

【问题讨论】:

    标签: charts angular5 chart.js ng2-charts


    【解决方案1】:

    您可以只在选项中指定宽度和高度的值。但它没有响应。

    pieChartData =  {
      chartType: 'PieChart',
      dataTable: [
        ['Task', 'Hours per Day'],
        ['Work',     11],
        ['Eat',      2],
        ['Commute',  2],
        ['Watch TV', 2],
        ['Sleep',    7]
      ],
      options: {'title': 'Tasks', 
                'width': 700,
                'height': 600},
    };
    

    【讨论】:

    • 为了使其响应式使用 css,如 overflow-x: auto; overflow-y: hidden; -ms-overflow-style: -ms-autohiding-scrollbar;
    猜你喜欢
    • 2017-08-07
    • 2013-06-17
    • 1970-01-01
    • 1970-01-01
    • 2018-07-24
    • 2021-04-25
    • 1970-01-01
    • 2018-05-30
    • 2014-06-16
    相关资源
    最近更新 更多