Issues with Highchart resizing within an AngularJS environment

Incorporating Highcharts into my angularjs app to display statistics has been successful. The graph appears correctly upon page load.

However, when I adjust the orientation, the appearance changes

and then switching back from landscape to portrait results in a different look, see something like this

I have attempted various CSS modifications, but the chart fails to fit the screen properly after each orientation change. Is there a reason why Highcharts does not respond well to orientation changes?

EDIT: Code snippet

var chart1 = new Highcharts.chart('demograph', {
    
    "options": {
    "chart": {
      "type": "areaspline"
      
    },
    "plotOptions": {
      "series": {
        "stacking": ""
      }
    }
  },
  "series": [
    {
      "name": "Highest",
      "data": [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
      "type": "column",
      "id": "series-0"
    },
    {
      "name": "Lowest",
      "data": [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5],
      "type": "column",
      "id": "series-1"
    },
    {
      "name": "Average",
      "data": [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0],
      "type": "column",
      "id": "series-2"
    },
    {
      "name": 'Louis',
      "data": [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8],
      "id": "series-3",
      "type": "line"
    }
  ],
  "title": {
    "text": "Progress Report"
  },
  "credits": {
    "enabled": true
  },
  "loading": false,
  "size": {},
  "xAxis": {
    "categories": ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
    "title": {text: 'Tests'}
    },
    "yAxis": {
    "title": {text: 'Marks Obtained'}
    },
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<div class="col-md-12 col-sm-12 col-xs-12 myclass2" style="">
  <div id="demograph" class="clsdemograph" >Placeholder for chart</div>
</div>

Answer №1

Would you mind giving this code a shot?

<div id="demographics" class="closedDemographics" style="height: 100%; width: 100%; position: absolute;">Chart placeholder</div>

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

Updating the time and date format within an AngularJS application

I am receiving date and time data from the API and would like to adjust the format. The current format is "2016-05-12", "07:17:35". Desired format: 12-May-2016 7:30 PM: <table class="table"> <thead> <tr> <th& ...

Is it possible in Elasticsearch to dynamically construct and send a JSON query object?

Currently I am utilizing angularjs alongside elasticsearch.angular.js. Constructing a dynamic JSON query object to reflect user requests has been successfully achieved. I am now seeking assistance on how to pass this constructed object to the search API wi ...

How do I customize the border color for the Select component in Material UI?

I have been working on customizing the Select component provided by Material UI. Here is a visual representation of what it currently looks like: https://i.stack.imgur.com/YGheB.png My goal is to change the border-color of the select component from the ...

Ways to eliminate the gap between the currency symbol and the numerical value in HTML

Is there a way to eliminate the gap between the Currency Symbol and Amount? I've been attempting to get rid of the space between the currency symbol and the amount in my HTML code. However, even when I input decimals, there remains a gap between the ...

Sending data to SOAP API using AngularJS

I've been struggling to send data to a SOAP API but have hit a roadblock. I've attempted various methods but continue to encounter errors when making the API call. The API URL is - and it requires data in XML format like <?xml version="1.0" ...

The slider is malfunctioning and not functioning properly in JSFiddle

As a beginner in the world of coding, I decided to start my journey with Codecademy. Everything seemed to be going smoothly as I created a carousel image slider using JQuery. However, when I tried implementing the same code on jsfiddle, the slider became s ...

Updating the timer for a logged-in user in PHP without relying on AJAX requests

I am currently working on a web application called Online Exam utilizing PHP+MySQL and AngularJS. I am facing issues regarding the user's logged in status within the project. Let's consider the following scenario: Imagine an authorized user/stu ...

Issues arise with the form functionality when incorporating ng-include

Why is my form not working when inserted using ng-include, but works fine when manually pasted in the html template instead of using ng-include? Is there a reason why forms are disabled with ng-include? <div ng-include src="'views/login_form.html& ...

Transitioning from a fixed position to absolute in CSS3

Sticky Logo Element In my project, I implemented a logo element that is positioned absolutely within the document. As the user scrolls, the logo sticks to the top of the window with a fixed position (you can view an example here: https://jsfiddle.net/swzb ...

Incorporating a CSS file within a JSP page

I've been struggling to get my '.jsp' file to utilize a '.css' file that I created. Initially, I stored the '.css' file in the 'WEB-INF' folder but discovered that this folder is not accessible publicly. So, I m ...

Determine the number of elements chosen within a complex JSON structure

I need to figure out how to count the length of a jsonArray, but I'm stuck. Here's an example to start with: https://jsfiddle.net/vuqcopm7/13/ In summary, if you click on an item in the list, such as "asd1", it will create an input text every t ...

I need to figure out how to incorporate a specific feature into my personal list by leveraging Javascript

Looking at the list below, it's a simple one that allows users to add and remove items while also changing their order using buttons. However, I want to enhance this feature by removing the "up" button for the first item and the "down" button for the ...

What is the best way to retrieve the value of a property within a JavaScript object?

I am facing an issue with retrieving the value of the status property from an object in my code. Below is a snippet of what I have tried: console.log("Resource.query()"); console.log(Resource.query()); console.log("Resource.query().status"); console.log(R ...

Personalizing the mat-checkbox

I'm trying to customize the checked icon in angular material mat-checkbox. Currently, it displays a white tick icon inside a colored background box, but I want to replace the tick with a cross when it is checked. After spending all day searching, I ha ...

The elusive Holy Grail layout for Flex content cannot be achieved on IE11

UPDATE I attempted to insert height:100vh into the .app-container, but unfortunately, it did not have the desired effect. I am utilizing bootstrap 4 for creating my web application. My goal is to implement the Holy grail layout. Everything appears to be ...

Styling just a single div when the state changes

I have a scenario where I am rendering 4 divs based on data fetched from my backend. Each div is colored according to a state change. While I have successfully implemented this, the issue is that all 4 divs can be colored in this way simultaneously. I want ...

Creating a gallery layout using Flexbox that maintains the aspect ratio of images of varying sizes

I've been working on creating a gallery layout using flexbox similar to this design: Example of desired outcome The goal is to have images displayed in two columns next to each other, resizing to the size of the largest image without distortion. On m ...

Ways to enclose this text with a white border and apply a box-shadow

How can I modify text similar to this image and what is the process involved? https://i.sstatic.net/lFcGV.png ...

What is the best way to place one box on top of another box?

Is there a way to set the CSS position to animate a box (inside) that is within another box (outside) that is not the same height as the inner box, in order to move it from the bottom to the top? Here is what I have been attempting with animation: $(&apo ...

Intellisense feature for Protractor in Visual Studio 2013

As a newcomer to the world of node.js, angular.js, protractor.js and jasmine.js, I must admit that I am not well-versed in web development. However, I am currently working on creating some protractor tests for an Angular app and so far, things are going sm ...