如何将垂直和水平滚动条添加到Kendo图表

问题描述 投票:1回答:1

我使用的是kendo图表,我希望y轴上的类别和x轴上的日期为静态,并希望滚动条表示图表而不是取div并且还希望条形尺寸小而字体大小应小于这个例子。

Stackblitz example

angular angular6 kendo-grid kendo-chart
1个回答
1
投票

为了实现它,不得不这样做

  1. 在组件定义中添加样式部分
  2. 从div中删除了内联样式

app.component.ts更改如下:

@Component({
    selector: 'my-app',
    template: `
        <div >
          <kendo-chart style="width: 3832px" [valueAxis]="valueAxis" [ngStyle]="{ 'height.px': chartHeight }">
            <kendo-chart-plot-area background="#F2F2F2"></kendo-chart-plot-area>
            <kendo-chart-series>
                <kendo-chart-series-item *ngFor="let series of model"
                type="rangeBar" [spacing]="-1" [data]="series.data" [opacity]="0.8" fromField="Start" toField="End" categoryField="Category">
                </kendo-chart-series-item>
            </kendo-chart-series>         
          </kendo-chart>
        </div>
    `,
    styles:[` 
      kendo-chart{ max-width: 525px; max-height: 300px;}
      ::ng-deep g>text{ font-size: 11px !important;}
    `]
})

完成working demo here

© www.soinside.com 2019 - 2024. All rights reserved.