What could be causing the ngx-chart TreeMap labels to not display in IE11?

I am currently utilizing ngx-charts version 10.0.1 to create Treemap charts. My Angular version is 7.2.1. The chart functions as expected in Chrome, but the labels do not appear in IE11. Upon page load, I encounter the following errors in the IE console:

TypeError: Object doesn't support property or method 'forEach' (Note: I am using a forEach loop to process data from the backend, I have also attempted converting it into a regular for loop without success.)

TypeError: Unable to set property 'pointer-events' of undefined or null reference.

Additionally, the hover and click animations are significantly slower in IE compared to Chrome. The tooltip displays the label and value correctly.

Techniques I have attempted so far:

1) After researching forums, I installed classlist.js and included the following links in Index.html

<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js" charset="utf-8"></script>
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/classlist.js/classList.min.js"></script>

<script src="node_modules/zone.js/dist/zone.min.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>

2) I added animations.js and ensured it was properly installed. 3) Attempted a rollback to ngx-charts version 8.1.0.

However, none of the above methods resolved the issue.

Here is the code snippet from my Polyfills.ts file:

import 'core-js/es6/symbol';
import 'core-js/es6/object';
...
...

(window as any).global = window;
if (!Object.entries) {
    Object.entries = function (obj) {
        var ownProps = Object.keys(obj),
            i = ownProps.length,
            resArray = new Array(i); // preallocate the Array
        while (i--)
            resArray[i] = [ownProps[i], obj[ownProps[i]]];

        return resArray;
    };
}

Answer №1

If you are encountering the pointer events error while hovering over the chart, including the following script either in the index.html file or just the IIFE in the polyfills.ts can resolve the issue:

    <script>
        (function (window) {
            try {
                new MouseEvent('test');
                return false; // No need to polyfill
            } catch (e) {
                // Need to polyfill - fall through
            }

            // Polyfills DOM4 MouseEvent

            var MouseEvent = function (eventType, params) {
                params = params || { bubbles: false, cancelable: false };
                var mouseEvent = document.createEvent('MouseEvent');
                mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

                return mouseEvent;
            }

            MouseEvent.prototype = Event.prototype;

            window.MouseEvent = MouseEvent;
        })(window);
    </script>

I also came across an issue with a for each loop in a library. Despite IE11 supporting the forEach loop as per MDN, adding this polyfill proved to be beneficial:

// Production steps of ECMA-262, Edition 5, 15.4.4.18
// Reference: http://es5.github.io/#x15.4.4.18
if (!Array.prototype.forEach) {

  Array.prototype.forEach = function(callback, thisArg) {

    var T, k;

    if (this === null) {
      throw new TypeError(' this is null or not defined');
    }

    // Rest of the code snippet remains unchanged
}

Edit

If the above solutions do not work, consider removing unnecessary imports that might cause conflicts (such as d3, ...) or importing the same things multiple times (e.g. shim.min.js in both index.html and polyfills.ts)

To ensure ngx-charts functions correctly, refer to the additions needed in polyfill.ts outlined here.

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

Error message: Angular Universal running on Docker encountered an HTTP failure response from an unidentified URL

My current setup consists of the following: I have four services defined in my docker-compose.yml file: my_nginx, my_client, my_api, and my_db. Using my_nginx as a proxy pass to access my_client:8000 and my_api:8001, both running on Node.js. The my_clie ...

Angular 2 TypeScript: The concat() function operates as mutable within the framework

When I declare an array on an @Injectable provider, my intention is to use it across different components. normeList: any[] = [ { name: 'choice 1', type:'false' }, { name: 'choice 2', typ ...

Internationalization of deferred-loaded modules within the JHipster application

I created My App using JHipster, which utilizes the JhiLanguageService in the ng-jhipster library. This service relies on the JhiConfigService to configure ngx-translate without requiring manual imports and configuration of the TranslateModule in my app.mo ...

The type 'Observable<Response>' does not include a property called 'map'

I recently started learning angular and npm, but encountered an error while trying to replicate some code from a source I found (linked here). It seems like the error is related to my development environment, but I'm having trouble pinpointing the ex ...

Group multiple typescript files into separate outFile modules

Can TypeScript files be grouped into multiple outFiles? I want to bundle my Typescript code, but instead of one single JS file, I would like to organize my TS into separate JS files such as controllers.js and plugins.js. The options in the TypeScript pro ...

What is the procedure for sending a secondary route parameter to the angular 2 services module?

I'm a beginner with Angular 2 and I'm seeking advice on how to pass multiple parameters to Angular's service module. For instance, here is the first parameter I'm passing to the service through the router link. In the home-component.ht ...

Avoid connecting redux to a component in TypeScript and React

I am having an issue with the "connect" function not wrapping my App component, causing Redux to not work. I have tried cloning some repositories with react+redux+typescript and they all work fine, but my application does not. As a result, I am unable to ...

Ways to incorporate style links in Angular v2 components?

Currently, I am working through the Angular tutorial available on their website. In my quest to create various components, templates, and styles, I have hit a roadblock. The issue lies in incorporating my styles into the components using the 'styleUR ...

When the child component's form is marked as dirty, the parent component can access it

I have implemented a feature in my application that notifies users about pending changes on a form before they navigate away. Everything works as expected, but I have a child component with its own form that needs to be accessed by the guard to check if i ...

Using Angular to Generate a File from Form Input and Delivering it to the User

I am attempting to develop a feature in Angular 9 that takes user input from a textarea, processes it, and then presents it back to the user as a downloadable (txt) file. The structure of the form in app.component.html is as follows: <form (ngSubmit)= ...

Setting up Angular material typography styling

I am struggling to make this work on my web application. As a solution, I decided to create a new Angular 15 project from the command line interface and added material using the command "ng add @angular/material". In order to simplify things, I modified a ...

Guide on enabling the Access-Control-Allow-Origin feature for Angular 5 and Node.js:

After exploring various methods to include 'Access-Control-Allow-Origin', I have not been successful in resolving the issue. I am utilizing the @angular/common/http module with an external URL as a data source. However, when attempting to retrie ...

Error: TypeError encountered during UI Runtime JSON conversion of Circular Data Structure

I'm facing an issue while attempting to parse and stringify certain JSON data. The error occurs on this specific line of code: this.copyOfColumns = JSON.parse(JSON.stringify(Object.assign([], this.columns))); Below is the complete @Input (using Ang ...

Issue encountered while utilizing npm on Visual Studio 2015

I'm attempting to run my Angular2 project with Visual Studio 2015. It works perfectly when I start it using npm in the windows console with the command 'npm start'. However, when trying to do the same thing using npm Task Runner for VS, I e ...

What is the best way to make one element's click event toggle the visibility of another element in Angular 4?

Recently diving into Angular, I'm working on a feature where users can toggle the visibility of a row of details by simply clicking on the item row. The scenario involves a table displaying log entries, each with a hidden row underneath containing spe ...

Leveraging pipes in Angular 2 within the (click) event handler

I have a question that may seem simple, but I'm struggling to figure out how to use a pipe within an event like (click). Here is an example of what I'm trying to do: <button (click)="quizAnswers(answer?.texte | translate | async)"></but ...

Experience Next.js 13 with Chakra UI where you can enjoy Dark Mode without the annoying White Screen Flash or FOUC (flash of unstyled content)

Upon refreshing the page in my Next.js 13 /app folder application using Chakra UI, I notice a few things: A momentary white flash appears before switching to the dark theme. The internationalization and font settings momentarily revert to default before l ...

Transmit information to the transcluded instance of a repeated element from a component that is

I am facing a challenge in Angular 2 as I try to include ng-content within ngFor inside my component. The issue lies in the fact that I need to pass some data into the transcluded element. I came across a solution for AgularJS which can be found here. Che ...

Hold off on making any promises regarding Angular 2

Let me start by stating that I have gone through many responses and I am aware that blocking a thread while waiting for a response is not ideal. However, the issue I am facing is quite complex and not as straightforward to resolve. In my advanced project, ...

Accessing collection values from referenced document IDs in Firestore---I have provided a unique version of the text

I have two fire store collections with the following reference images: https://i.sstatic.net/QVJkZ.pnghttps://i.sstatic.net/0QFRi.png. I am trying to retrieve the firstName and title from these collections. The signup_id is referenced from the document id ...