Empty screen on the RadCartesianChart

I've recently started learning about Nativescript development and encountered an issue while trying to implement the Nativescript-ui-chart in my app. When I load the page I created, the screen goes blank with nothing being displayed.

I followed the instructions provided in this guide . Additionally, I downloaded and tested the Sample code from Git-Hub, which worked perfectly fine. However, when I tried to replicate the code in my project, it resulted in the same blank screen issue as mentioned earlier.

At this point, I suspect that the problem lies within the libraries I am using, possibly due to some compatibility issues with the charts.

I utilized the exact code provided in the link above...

<RadCartesianChart>
   <CategoricalAxis tkCartesianHorizontalAxis></CategoricalAxis>
   <LinearAxis tkCartesianVerticalAxis></LinearAxis>
   <LineSeries tkCartesianSeries [items]="categoricalSource" 
               categoryProperty="Country" valueProperty="Amount">
   </LineSeries>
</RadCartesianChart>
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 }
    ];


  }
}


@Component({
  selector: "ns-service-detail",
  templateUrl: "./service-detail.component.html",
  styleUrls: ["./service-detail.component.scss"],
  moduleId: module.id,
  providers: [DataService],
})
export class ServiceDetailComponent {

  ngOnInit() {

      this._categoricalSource = new ObservableArray(this._dataService.getCategoricalSource());

  }

  private _categoricalSource: ObservableArray<Country>;



  get categoricalSource(): ObservableArray<Country> {
    return this._categoricalSource;
  }

}


export class Country {
  constructor(public Country?: string, public Amount?: number, public SecondVal?: number, public ThirdVal?: number, public Impact?: number, public Year?: number) {
  }
}

Although no errors are appearing in the console log, debugging this issue has proven to be quite challenging for me.

Answer №1

If you're looking to add a chart to your project, I've set up a demo playground here. Make sure to enclose your chart within a Layout component.

<GridLayout rows="*" height="1000px">
                <RadCartesianChart row="0">
                    <CategoricalAxis tkCartesianHorizontalAxis></CategoricalAxis>
                    <LinearAxis tkCartesianVerticalAxis></LinearAxis>
                    <LineSeries tkCartesianSeries [items]="categoricalSource"
                        categoryProperty="Country" valueProperty="Amount"></LineSeries>
                </RadCartesianChart>
            </GridLayout>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

increase the selected date in an Angular datepicker by 10 days

I have a datepicker value in the following format: `Fri Mar 01 2021 00:00:00 GMT+0530 (India Standard Time)` My goal is to add 60 days to this date. After performing the addition, the updated value appears as: `Fri Apr 29 2021 00:00:00 GMT+0530 (India St ...

The problem with RXJS pipe in Angular application is that it evaluates excessively, leading to eventual breakdown

I'm experiencing challenges when attempting to fork an Observable (that has been piped multiple times): subscribing to it in one place, and piping and subscribing to it in another place. I am facing 2 issues: The pipes are being evaluated multiple t ...

What is the best way to locate this particular element on the webpage?

After using the right-click and selecting inspect element, I located the code of the desired element on the webpage: <input type="text" ng-if="!editing" ng-model="item.Price" ng-click="inputFocus()" ts="" required="" placeholder="قیمت :" class="ng- ...

Scroll pagination and sorting in Angular 4

Currently delving into Angular 4 and still getting the hang of things. Attempting to implement a table(grid) with scroll pagination and sorting abilities. Has anyone come across a component that enables this functionality? ...

Angular directive unit testing results in an Access to XMLHttpRequest error being thrown

Here is a custom directive example: @Directive({ selector: '[appTitleCase]', }) export class TitleCaseDirective { @HostListener('change', ['$event']) onChange($event: Event) { const titleCaseValue = TextHelpers.convert ...

What is the reason behind the never return value in this typescript template?

As demonstrated in this example using TypeScript: Access TypeScript Playground type FirstOrSecond<condition, T1, T2> = condition extends never ? T1 : T2 type foo = never extends never ? () => 'hi' : (arg1: never) => 'hi' ...

adjust the child component by directly accessing its reference

Struggling to update a child component from the parent component using its reference, but running into some issues. Here's what I've attempted so far: class MainApp extends React.Component<any, any> { construct ...

Obtaining Input Field Value in Angular Using Code

How can I pass input values to a function in order to trigger an alert? Check out the HTML code below: <div class="container p-5 "> <input #titleInput *ngIf="isClicked" type="text" class="col-4"><br& ...

Sending a multi-layered object to a Modal with NavParams in Ionic

My Ionic page involves passing an array of objects to my Modal page: export class SelectAddress{ constructor( public id : string, public number : string, public line1 : string, public postcode: string ){} } I tried ...

Looking for guidance on where to find a functional code sample or comprehensive tutorial on working with ViewMetadata in Angular2

I am currently trying to understand the relationship between viewmetadata and the fundamental use of encapsulation: ViewEncapsulation, including ViewEncapsulation.Emulated and ViewEncapsulation.None. Here is a link for further information: https://angula ...

Leveraging TypeScript alongside body-parser to access properties within req.body

I'm currently developing a web application using TypeScript and integrating the body-parser middleware to handle JSON request bodies. I've encountered type errors while attempting to access properties on the Request.body object. For instance, wh ...

Creating a TypeScript declaration file for a singular module

Consider the following directory structure: src/ ├── foo.ts ├── bar.ts ├── baz.ts ├── index.ts If foo.ts, bar.ts, and baz.ts each export a default class or object, for example in foo.ts: export default class Foo { x = 2; } I ...

A guide on automatically focusing on a Material UI Formik form TextField using React and TypeScript

I'm attempting to automatically focus my textField, but the 'autoFocus' attribute only seems to work after I submit the form and add a value. If no values are added (i.e. when opening the miui modal for the first time), the autoFocus does no ...

Trouble encountered with Angular Google Maps integration when using router-outlet

Currently, I am in the process of developing an application that features a map as its header (providing a global view) and another map positioned in the center of the page to showcase detailed views. To demonstrate this setup, I have shared a working exam ...

typescript: declaring types in a separate JavaScript file

Imagine you have a JavaScript library that exports some types for use (let's call it js1.js). You also have some TypeScript code sitting in a <script type="module"> tag that you want to use these types with (let's say ts1.ts). To make this ...

Modify the name of the variable when sending the object to an HTTP service in Angular version 6

export class ShopModel { public id: number; public name: string; public email: string; public phone: string; public website: string; public address: string; public gst_number: string; public pan_number: string; public ta ...

Issue: The function react.useState is either not defined or its output is not iterable

I'm facing an issue while programming in Next.js 13. Any help or suggestions would be greatly appreciated! Here are the relevant files: typingtext.tsx import React from "react"; export function useTypedText(text: string, speed: number, dela ...

The Type '{Property: string, Property2: string} does not match the type Observable<Filters[]>

Here is a method I am trying to use: getFilters(): Observable<Filters[]> { let filters: Observable<Filters[]> = [ { property: "Value", property2: "Value2" }, { property: "Value3", property2: "V ...

Obtain the Nodes attribute using PrimeNG

Here is the JSON output I am working with: { "data": [ { "label": "The Avengers", "data": { "name" : "The Avengers", "type" : "book"}, "expandedIcon": "fa-folder-open", "collapsedIcon": "fa-folder", "leaf": true ...

What exactly is happening with this Plunkr code?

When variables or expressions are used within brackets [] in Angular, what is the scope of these variables? In the Plunkr code provided below, the variable helloWorld is defined in the rio-app but utilized in the rio-hello. Does Angular search all the way ...