Unexpected behavior in Internet Explorer with ChartJS version 2.6.0

When using ChartJS v2.6 to create a pieChart within a Bootstrap Grid, everything appears correctly in Chrome and Firefox, but not in Internet Explorer. In IE, the chart is unintentionally stretched on larger screens. Bootstrap should handle the sizing, but I can't pinpoint the issue. Can anyone here help me determine if it's a CSS or ChartJS problem and how to resolve it?

The Webservice has been uploaded to a VPS because the original hosting environment is secure, hence the incorrect certificate.

This section contains the Chart and Legend on the right side

    <div class="row" >
        <div id="charts" class="col-sm-7">
            <div id="chartWrapper" class="row">
                <canvas id="questionChart"></canvas>
            </div>
            <div class="col-12 correctAnswers" style="display: none"></div>

            <div class="col-12 answerTime">
                <div id="buttongrp"></div>
                <div id="answerCount"></div>
            </div>
        </div>

        <div id="legendContainer" class="col-sm-5">
            ....
        </div>
    </div>

This is how the Chart is created

            ctx = document.getElementById("questionChart");
            chart = new Chart(ctx, { //The chart options vary significantly by question type
                type: 'pie',
                data: {
                    labels: dataCountMap.keys(), //Generating labels from Map keys
                    datasets: [{
                        label: '# of Votes',
                        data: dataCountMap.values(), //Generating chart data from Map values
                        backgroundColor: usedColors, // Randomly chosen colors from the array defined in the options
                        hoverBackgroundColor: usedHoverColors
                    }]
                },
                options: {
                    aspectRatio: 1,
                    legend: {
                        display: false
                    },
                    showAllTooltips: true,
                    tooltips: {
                        callbacks: {
                            label: function (tooltipItem, data) {
                                var value = data.datasets[0].data[tooltipItem.index];
                                return value;
                            },
                            title: function (tooltipItem, data) {
                                return '';
                            }
                        },
                        tooltipTitleFontSize: 0,
                        bodyFontSize: 30,
                        displayColors: false,
                        xPadding: 10,
                        backgroundColor: '#323232'
                    }
                }
            });

This section contains the CSS for scaling the Chart

        @media (max-width: 575px) {
        .pieChart {
            padding: 0px 60px 20px 60px;
        }
        .barChart {
            margin: 0px;
            padding: 0px 40px 20px 40px;
        }
    }

    @media (min-width: 576px) and (max-width: 767px) {
        .pieChart {
            padding: 0px 20px 0px 20px;
        }
        .barChart {
            margin: 0px;
            padding: 0px 10px 0px 10px;
        }
    }

    @media (min-width: 768px) and (max-width: 860px) {
        .pieChart {
            padding: 0px 60px 0px 60px;
        }

        .barChart {
            margin: 0px;
            padding: 0px 20px 0px 20px;
        }
    }

    @media (min-width: 861px) and (max-width: 991px) {
        .pieChart {
            padding: 0px 85px 0px 85px;
        }

        .barChart {
            margin: 0px;
            padding: 0px 20px 0px 20px;
        }
    }

    @media (min-width: 992px) and (max-width: 1100px) {
        .pieChart {
            padding: 0px 110px 0px 110px;
        }
        .barChart {
            margin: 0px;
            padding: 0px 60px 0px 60px;
        }
    }

    @media (min-width: 1101px) and (max-width: 1199px) {
        .pieChart {
            padding: 0px 130px 0px 130px;
        }
        .barChart {
            margin: 0px;
            padding: 0px 60px 0px 60px;
        }
    }

This is the view in Chrome:

This is the view in IE:

Thank you

Answer №1

The issue can be resolved by removing the following style from style.css:

@media and (min-width:1200px) {
    .pieChart {
        padding: 0px 11vw 0 11vw;
    }
}

Removing this style will address the problem in IE.

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

Customizing your buttons in Wordpress with extra CSS styles upon clicking

I am in the process of developing a Wordpress website and I require a button for switching between mobile and desktop versions manually. Within my .css file, I have included: @media (pointer:coarse) {} This adds modifications for the mobile version ...

Tips on how to align a wrapper-div in the center without affecting the positioning of the

I am looking to keep my page perfectly centered in the browser without affecting the content (similar to how align-text: center works). Specifically, I want to center my wrapper-div. How can I achieve this? Here is a simplified version of my current page ...

angularjs: container holding directive is currently not visible, with a height and width of 0 pixels

When implementing a directive in this way, the actual element (<a-directive>) appears to have dimensions of 0px height and 0px width. View jsfiddle example var myApp = angular.module('myApp', []).directive('aDirective', function ...

Tips for creating a dynamic logo that zooms in when you hover over it

Is there a way to create a zoom effect for the logo in my navigation bar when hovering over it without using jQuery? I've tried various codes from different sources but none seem to work. The .logo class is assigned to the logo in the nav bar. Any sug ...

Angular and Bootstrap4: The Perfect Duo for Modals

I need to display a Bootstrap4 modal window in Angular when a specific condition is met in my "bookTour" method without the need for a direct button click. How can I achieve this? Below is the code snippet: html <div class="modal" id="myModal" [ngClass ...

Tips for emphasizing v-list-item on click (Vue)

I am currently working on a side menu that changes based on the selected router model. My goal is to have the selected page highlighted when clicked. I would like this functionality for all the submenus as demonstrated in this example. Below are snippets ...

Issue with child div exceeding 100% height within CSS Flexbox causing inconsistency in Firefox and Chrome browsers

I am facing a challenge trying to make a div resize to match its parent's height using flexbox. This issue seems to occur only in Chrome (48), as it displays correctly in Firefox (44). You can view the example on Fiddle: https://jsfiddle.net/jvilla/k ...

How to emphasize a clicked hyperlink in AngularJS

Here's the HTML code I've been working on: <div id="Navigation" class="md-dialog-full"> <div class="products-options"> <a ng-click='addType("Physical")' href="javascript:void(0);"> < ...

Tips for adjusting the legend on a chart in chart.js when the text is being truncated

https://i.sstatic.net/5IzUO.png Is there a way to eliminate the extra space on the left and right side of the bar so that the legend can be fully displayed with the entire text? ...

Displaying markers on a Google map by fetching data from a MySQL database in PHP

The image attached here serves as an example. You can view it here. Currently, I display locations on a map in an HTML page with static code like: Here is the JavaScript code to load the map on the page: <script type="text/javascript" src="https://ma ...

Update the loading animation to utilize a custom image instead

I found a preloader code on this website that rotates fontawesome icons and displays the percentage after a few seconds. However, I am looking to replace the fontawesome icon with an image but have been unsuccessful in my attempts. Is there a way to easil ...

Ensuring that all of the content is adaptable across various devices, from smartphones to high-definition 1080p screens

I am currently working on making my entire content responsive. While I have successfully made the background responsive using different @media resolutions, I am facing an issue with the image in the foreground that is not scaling accordingly. I tried putti ...

Font Awesome icons are preventing the navigation bar from collapsing

Just getting started with Bootstrap and facing an issue. I want to include a collapsed user icon that expands when clicked. However, when I add the navbar-toggle class, the icon disappears completely. Without it, the icon appears but doesn't collapse ...

Ways to rotate SVG images exclusively upon clicking

After experimenting with rotating SVG images on my navbar buttons, I encountered an issue. Whenever I click one button, all the images rotate simultaneously. Additionally, clicking elsewhere does not reset the images to their original positions. This is t ...

Sass compilation with source mapping

Is there a more efficient method to compile my sass files with sourcemap enabled other than using the command below? sass --compass --sourcemap --style compact --watch sass:css In the case of utilizing compass, 'compass watch' would be the pref ...

How to Retrieve the Url of a Clicked Element using CSS Property

Is it possible to retrieve the URL when a link is clicked using CSS alone, without relying on JavaScript or jQuery? ...

Step-by-step guide on arranging/placing/styling two div elements next to each other

I'm facing an issue with my CSS and HTML. I can't seem to get the 2 footer items to display on the same line. Is there a problem with how I've structured my divs and styles? Any suggestions for improving the code are greatly appreciated. I& ...

Differences in Spacing: Exploring Bootstrap v5.1.1 Compared to 4.0

After comparing two pages, one using Bootstrap v5.1.1 and the other with 4.0.0, I have observed differences in spacing. Bootstrap v5.1.1: .topspacer { padding-top: 70px; } .righticon { float: right; } .clear { clear: both; } a { text- ...

The toggle feature in jQuery doesn't hide content in the same manner as it was originally shown

Just diving into the world of jquery and I'm experimenting with the toggle function to display and hide a div, along with adding or removing an active class. http://jsfiddle.net/MAkyw/ I've encountered 2 issues: 1) The 'active' class ...

I am trying to verify my code, but the messages are not displaying under the username. They only appear under the password field. I am not sure where I have made a mistake

Having trouble with my login form validation using jQuery. Can someone help me fix it? $(document).ready(function() { $("#form1").validate({ rules: { username: { required: true, minlength: 6 }, password: { ...