AmCharts 4: defining the grid interval

I am currently working on creating a polar chart to showcase Satellite data.

https://i.sstatic.net/DNUZ1.jpg

However, I am facing a challenge with setting the grid size to be displayed in increments of 45 degrees. Despite trying various amcharts 4 functions, I have been unable to achieve the desired outcome.

The closest workaround I have found involves using steps of 10 degrees with minGridDistance and formatting the label to only display multiples of 30, as multiples of 45 (an odd number) do not work properly.

Below is the code snippet I am currently using:

  private configureChart() {
    this.series = {};

    const chart = this.chart = am4core.create('chartdiv', am4charts.RadarChart);

    /* Create axes */
    const xAxis = chart.xAxes.push(new am4charts.ValueAxis<am4charts.AxisRendererCircular>());
    xAxis.renderer.axisFills.template.disabled = true;
    xAxis.renderer.minLabelPosition = 0.01;

    // xAxis.renderer.minGridDistance = 10;

    // xAxis.formatLabel = (value: number) => {
    //   if (value % 30 === 0) {
    //     return value.toString();
    //   }
    // };

    xAxis.strictMinMax = true;
    xAxis.max = 360;
    xAxis.min = 0;

    const yAxis = chart.yAxes.push(new am4charts.ValueAxis<am4charts.AxisRendererRadial>());
    yAxis.renderer.labels.template.verticalCenter = 'bottom';
    yAxis.renderer.labels.template.horizontalCenter = 'right';
    yAxis.renderer.minLabelPosition = 0.01;
    yAxis.renderer.inversed = true;
    yAxis.strictMinMax = true;
    yAxis.max = 90;
    yAxis.min = 0;

    this.createSeries('GPS', 'GP', '#98BD4A');
    this.createSeries('GLN', 'GL', '#DEAE4E');
    this.createSeries('GAL', 'GA', '#6BB4DB');
    this.createSeries('BDS', 'BD', '#B543C1');

    /* Add legend */
    chart.legend = new am4charts.Legend();

    /* Add cursor */
    chart.cursor = new am4charts.RadarCursor();
  }

  private createSeries(title: string, key: string, color: string) {
    const chart = this.chart;

    /* Create and configure series */
    const series = chart.series.push(new am4charts.RadarSeries());
    series.fill = am4core.color(color);
    series.dataFields.valueX = 'azimuth';
    series.dataFields.valueY = 'elevation';
    series.sequencedInterpolation = true;
    series.sequencedInterpolationDelay = 10;
    series.strokeOpacity = 0;
    series.name = title;
    series.data = [];

    const circleBullet = series.bullets.push(new am4charts.CircleBullet());
    circleBullet.circle.strokeOpacity = 0;
    circleBullet.circle.radius = 8;
    circleBullet.tooltipText = `SAT PRN {prn}
    Azim: {azimuth}º
    Elev: {elevation}º
    Stat: {snr}dBHz`;

    this.series[key] = series;
  }

Answer №1

1) To turn off the grid completely, you can set

axis.grid.template.disabled = true;
2) Another option is to include AxisRanges for specific values. For more information on ranges, visit:

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

Tips for displaying dynamic Angular custom elements

I've been working on projects that have implemented the Angular web component concept, as outlined in the Angular guide. Currently, we only have 2 or 3 elements that are displayed dynamically based on user input. Once the user completes the form, the ...

Can the arrow function properly subscribe to an Observable in Angular and what is the accurate way to interpret it?

I'm currently working through the official Angular tutorial: https://angular.io/tutorial/toh-pt4 Within this tutorial, there is a component class that subscribes to a service: import { Component, OnInit } from '@angular/core'; import { He ...

What strategies can I implement to reduce the size of my Angular application to 500K or less?

I have been researching ways to reduce the size of my Angular application, but have not yet found a solution that significantly decreases its size. Currently, my application is 4M in production and 14M in development. So far, I have tried: Lazily loadin ...

Angular Typescript filter function returning an empty arrayIn an Angular project, a

I have a filtering function in Angular that is returning an empty array. Despite trying similar solutions from previous questions, the issue persists. The function itself appears to be correct. Any assistance would be greatly appreciated. gifts represents ...

How can Angular 4 manage an object containing other objects most effectively?

Who can guide me on the best way to handle a data structure like this: { "1":{ "id":"1", "name":"Facebook", "created_at":"", "updated_at":"", "fields":{ "1":{ "id":"1" ...

Compiling Typescript with module imports

In my project, I am working with two files named a.ts and b.ts. The interesting part is that file b exports something for file a to use. While the TypeScript compiler handles this setup perfectly, it fails to generate valid output for a browser environment ...

Encountering a timeout issue with the Sinch API within an Angular 2 project during the onCallProgressing

We successfully integrated Sinch into our angular 2 web application. Most functionalities are working perfectly, except for the user calling feature using the sinch phone demo. When the application is in the foreground, the call rings and connects withou ...

Try skipping ahead to the following spec file even if the initial spec has not been completed yet

I have encountered an issue when trying to execute two spec files for Angular.js. The problem arises when I attempt to run both files consecutively - the browser initially opens for angular.js, then switches to angularCal.js without executing angular.js ...

Best Practices for Angular (2) Form Validation on the Server Side

Struggling to implement server-side form validation using Angular 2, specifically with the following setup: A basic form with login and password fields linked to the view via ngForm / ngModel directives Template-based form structure Synchronous validatio ...

Attempting to incorporate an npm package (specifically Howler) into an Angular 2 application

I'm facing an issue with importing Howler into my Angular 2 app as it doesn't have a typings file. Despite my efforts in searching for a solution, I haven't been able to find anything helpful. Can someone guide me on how to import "howler" i ...

Is it possible for a hybrid app using Angular 7/1.x to enable Hot Module Replacement (H

Having trouble implementing HMR on a hybrid Angular application using the downgradeModule strategy. I previously sought help from a similar question on Stack Overflow Can an Angular 5/1.x hybrid app support HMR? but didn't find a satisfactory answer. ...

The Angular 2 HTTP GET method is throwing a type 3 error when trying to access the

i am encountering an issue while trying to retrieve a response from my asp.core api within Angular 2. The error message received is: "Object { _body: error, status: 0, ok: false, statusText: "", headers: {…}, type: 3, url: null }" Component: import { C ...

What is the best way to utilize Object.keys() for working with nested objects?

When working with nested objects, I am trying to access the properties using Object.keys() and forEach(). However, I am encountering an issue when attempting to access the nested keys filteringState[item][el]. Is there a specific way to write a function f ...

Implementing GetServerSideProps with Next-Auth: Error message - Trying to destructure property 'nextauth' from 'req.query' which is undefined

I encountered an issue while using the getServerSideProps function in Next.js with Next-Auth. The error I received was a TypeError: TypeError: Cannot destructure property 'nextauth' of 'req.query' as it is undefined. Upon checking with ...

Showing an in-depth ngFor post on the screen

I am in the process of building a Blog with Angular 7, MongoDB, and NodeJS. Currently, I have developed a component that iterates through all the posts stored in the database and showcases them on a single page. <div class="container-fluid"> < ...

Tips for enlarging the font size of a number as the number increases

Utilizing the react-countup library to animate counting up to a specific value. When a user clicks a button, the generated value is 9.57, and through react-counter, it visually increments from 1.00 to 9.57 over time. Here's the code snippet: const { ...

What could be causing my vis.js network's node hover popups to not function properly?

I've encountered an issue where, despite adding the 'title' property to my node objects, the pop up window with the title content doesn't appear when I hover over a node. Here are the options I've chosen and how I've set up m ...

The utilization of Angular 2 and the assignment of formControlName values within a

Why must learning Angular2 be such a challenge? <input type="text" formControlName="exposure" type="hidden"> <label>{{exposure}}</label> When I use the formControlName in the input, the value is correct. How can I retrieve the value of ...

Using the 'onended' audio event emitter in Angular 2 along with a local member of the Component

I'm looking for assistance on how to utilize audio.onended() in order to play the next song in a playlist. I can successfully add songs to the playlist and play them using the above method with an audioObject. However, when audio.onended triggers, I ...

The ngxpagination template is currently experiencing issues with filtering and pagination functionality

I have encountered an issue with my custom pagination template using ngx-pagination. Everything works fine until I introduce a filter pipe alongside the pagination. The problem arises when the filtered data set is not properly paginated - instead of displa ...