Nativescript-图表未显示

Nativescript-图表未显示,nativescript,nativescript-angular,Nativescript,Nativescript Angular,我遵循nativescript ui示例 并且可以在运行应用程序时查看图表。当我在应用程序中使用相同的代码时,IOS和Android上都没有显示图表。我不知道怎么了。我是否错过了一些配置?谢谢 chart.component.html <RadCartesianChart tkExampleTitle tkToggleNavButton> <CategoricalAxis tkCartesianHorizontalAxis lastLabelVisibility="Hi

我遵循nativescript ui示例 并且可以在运行应用程序时查看图表。当我在应用程序中使用相同的代码时,IOS和Android上都没有显示图表。我不知道怎么了。我是否错过了一些配置?谢谢

chart.component.html

<RadCartesianChart tkExampleTitle tkToggleNavButton>
    <CategoricalAxis tkCartesianHorizontalAxis lastLabelVisibility="Hidden" ios:firstLabelVisibility="Hidden"
        ios:plotMode="OnTicks">
    </CategoricalAxis>
    <LinearAxis tkCartesianVerticalAxis></LinearAxis>

    <AreaSeries tkCartesianSeries [items]="categoricalSource" categoryProperty="Country" valueProperty="Amount">
    </AreaSeries>
</RadCartesianChart>
data.service.ts


import { Country } from "./country";
import { Injectable } from '@angular/core';

@Injectable()
export class DataService {

    getCategoricalSource(): Country[] {
        return [
            { Country: "Germany", Amount: 15, SecondVal: 14, ThirdVal: 24, Impact: 0, Year: 0 },
            { Country: "France", Amount: 13, SecondVal: 23, ThirdVal: 25, Impact: 0, Year: 0 },
            { Country: "Bulgaria", Amount: 24, SecondVal: 17, ThirdVal: 23, Impact: 0, Year: 0 },
            { Country: "Spain", Amount: 11, SecondVal: 19, ThirdVal: 24, Impact: 0, Year: 0 },
            { Country: "USA", Amount: 18, SecondVal: 8, ThirdVal: 21, Impact: 0, Year: 0 }
        ];
    }
}
app-routing.module.ts

import { NgModule } from "@angular/core";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { Routes } from "@angular/router";

import { ChartComponent } from "./chart/chart.component";

const routes: Routes = [
    { path: "", redirectTo: "/charts", pathMatch: "full" },
    { path: "charts", component: ChartComponent }
];

@NgModule({
    imports: [NativeScriptRouterModule.forRoot(routes)],
    exports: [NativeScriptRouterModule]
})
export class AppRoutingModule { }

package.json

{
  "nativescript": {
    "id": "org.nativescript.boardgamehelper",
    "tns-android": {
      "version": "6.0.1"
    },
    "tns-ios": {
      "version": "6.0.1"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@angular/animations": "~8.0.0",
    "@angular/common": "~8.0.0",
    "@angular/compiler": "~8.0.0",
    "@angular/core": "~8.0.0",
    "@angular/forms": "~8.0.0",
    "@angular/http": "~8.0.0-beta.10",
    "@angular/platform-browser": "~8.0.0",
    "@angular/platform-browser-dynamic": "~8.0.0",
    "@angular/router": "~8.0.0",
    "nativescript-angular": "~8.0.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-chart": "^5.0.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "~6.5.0",
    "tns-core-modules": "6.0.2",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.0.0",
    "@ngtools/webpack": "~8.0.0",
    "nativescript-dev-webpack": "~1.0.0",
    "typescript": "3.4.5"
  },
  "gitHead": "8c1a4866a66daab09bf5ef8e5a96472687192373",
  "readme": "NativeScript Application"
}

{
“nativescript”:{
“id”:“org.nativescript.boardgamehelper”,
“tns安卓”:{
“版本”:“6.0.1”
},
“tns ios”:{
“版本”:“6.0.1”
}
},
“说明”:“NativeScript应用程序”,
“许可证”:“请参阅中的许可证”,
“存储库”:“,
“依赖项”:{
“@angular/animations”:“~8.0.0”,
“@angular/common”:“~8.0.0”,
“@angular/compiler”:“~8.0.0”,
“@angular/core”:“~8.0.0”,
“@angular/forms”:“~8.0.0”,
“@angular/http”:“~8.0.0-beta.10”,
“@angular/platform浏览器”:“~8.0.0”,
“@angular/platform browser dynamic”:“~8.0.0”,
“@angular/router”:“~8.0.0”,
“nativescript angular”:“~8.0.0”,
“nativescript主题核心”:“~1.0.4”,
“nativescript ui图表”:“^5.0.0”,
“反映元数据”:“~0.1.12”,
“rxjs”:“~6.5.0”,
“tns核心模块”:“6.0.2”,
“zone.js”:“~0.9.1”
},
“依赖性”:{
“@angular/compiler cli”:“~8.0.0”,
“@ngtools/webpack”:“~8.0.0”,
“nativescript开发网页包”:“~1.0.0”,
“类型脚本”:“3.4.5”
},
“gitHead”:“8c1a4866a66daab09bf5ef8e5a96472687192373”,
“自述文件”:“NativeScript应用程序”
}

您必须在模块中导入图表模块。例如

从“nativescript ui图表/角度”导入{nativescript ui图表模块}

import { NgModule } from "@angular/core";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { Routes } from "@angular/router";

import { ChartComponent } from "./chart/chart.component";

const routes: Routes = [
    { path: "", redirectTo: "/charts", pathMatch: "full" },
    { path: "charts", component: ChartComponent }
];

@NgModule({
    imports: [NativeScriptRouterModule.forRoot(routes)],
    exports: [NativeScriptRouterModule]
})
export class AppRoutingModule { }

{
  "nativescript": {
    "id": "org.nativescript.boardgamehelper",
    "tns-android": {
      "version": "6.0.1"
    },
    "tns-ios": {
      "version": "6.0.1"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@angular/animations": "~8.0.0",
    "@angular/common": "~8.0.0",
    "@angular/compiler": "~8.0.0",
    "@angular/core": "~8.0.0",
    "@angular/forms": "~8.0.0",
    "@angular/http": "~8.0.0-beta.10",
    "@angular/platform-browser": "~8.0.0",
    "@angular/platform-browser-dynamic": "~8.0.0",
    "@angular/router": "~8.0.0",
    "nativescript-angular": "~8.0.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-chart": "^5.0.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "~6.5.0",
    "tns-core-modules": "6.0.2",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.0.0",
    "@ngtools/webpack": "~8.0.0",
    "nativescript-dev-webpack": "~1.0.0",
    "typescript": "3.4.5"
  },
  "gitHead": "8c1a4866a66daab09bf5ef8e5a96472687192373",
  "readme": "NativeScript Application"
}