React - Highcharts Full Screen dark overlay

I am currently working on integrating highcharts/highstock into my application, and I have encountered an issue with the full screen functionality.

The challenge I am facing is setting a fixed height for my charts while also enabling the option to view each chart in full screen mode. When I try to go full screen, the fixed height remains the same, leading to display issues. I attempted the solution suggested in this post, but unfortunately, it did not work as expected. Setting the height to 100% resulted in the chart overflowing the page and being cropped based on the screen's aspect ratio.

I came across a demonstration that seems to be functional, but I am unable to replicate it successfully. I am unsure about how this individual is calling the component and displaying the export module (hamburger menu) without explicitly calling it.

render() {
    return <div className="chart" ref={ref => this.container = ref} />
  }

In my application, I am invoking the component like so:

render() {
  return (
    <HighchartsReact
      highcharts={Highcharts}
      constructorType="stockChart"
      options={options}
      allowChartUpdate
      callback={this.afterChartCreated}
    />
  )
}

I attempted assigning an ID to the element to set the height using CSS, but this approach did not yield the desired results.

While attempting to recreate my application with a functional example, I could only achieve it on CodeSandbox due to import structure limitations. However, I encountered an issue with the full screen feature and received the following message:

Full screen is not supported inside a frame.

Answer №1

This demonstration showcases the creation of a chart without utilizing the Highcharts React wrapper. It combines pure Highcharts JS with React, allowing the export menu to display without being explicitly called. The Highcharts React wrappers function similarly but offer more control in a 'React way'.

In regards to your issue, I recommend setting the height of the Highcharts component as inline React styling, which can be achieved by defining it in the containerProps object.

    <CardContent style={{ padding: 0 }}>
      <HighchartsReact
        highcharts={Highcharts}
        containerProps={{ style: { height: "400px" } }}
        options={options}
        allowChartUpdate
      />
    </CardContent> 

Demo: https://codesandbox.io/s/fix-full-screen-253sq?file=/src/CustomGUIChart.js

To test this, utilize the open in new window option on the codesandbox (button located just above the exporting menu hamburger).

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

Unlocking elements in Vue.js through functions

Looking to dynamically add a class to the label element when focusing on an input element below it. The current HTML and JS code I'm using is as follows: HTML: <label for="formProductId" ref="productIdLabel" class="form-element-title">Product ...

Merging double borders in a div using CSS is essential for creating

Upon examining this sample, it's evident that the borders do not blend together. css: div{ float:left; background-color:moccasin; width:100px; height:100px; border:1px solid tomato; } The number of divs is arbitrary, and only on ...

Error encountered in clientside js file: Node.js indicates that 'require' is not defined

In my JavaScript file, I have important data that needs to be saved into a Mongoose schema and then inserted into a MongoDB table. The schema is stored in a separate directory, so I attempted to import it by adding the following line at the beginning of th ...

Encountered a problem with AngularUniversal prerendering: UnhandledPromiseRejectionWarning: Unable to locate NgModule metadata for 'class{}'

Objective The task may seem lengthy, but it's straightforward! Currently, I am utilizing Angular Universal for Server-Side Rendering (SSR) by following a tutorial. The Universal/express-engine has been installed, main.js is generated in the dist/pro ...

Generate a fresh array using the data from the existing array object

I have nested objects within arrays that I need to manipulate. { "page": [ { "num": "1", "comp": [ { "foo": "bar", "bar": "foo", ...

The module 'SliderInput' is not being exported from '@mui/material/Slider' (imported as 'SliderInput') despite being designated as exported in the Slider.d.ts file

I am working on developing a custom Slider component and integrating my own InputComponent to display a tooltip when hovering over a specified range of values. To achieve this, I have imported SliderInput from "@mui/material/Slider" as shown below: impo ...

Tips for displaying a child React component for a specific duration

One of the React components I have is called PopUpBanner, which is utilized to display messages. For instance, in my login component, I employ it in this manner. If an error arises, the bannerMessage state is updated to showcase the message on the banner: ...

Tips for incorporating scrolling into a sub menu

I'm currently attempting to incorporate vertical scroll only for my sub-menu using CSS, without including a horizontal scroll. However, the issue arises when I remove the horizontal scroll - it causes the nested sub-menu within the initial one to bre ...

Error in Node JS: When attempting to use "require", a ReferenceError is thrown

After deciding to utilize a MySQL database, I proceeded by installing MySQL using the command npm i mysql. Following the installation, I included the line of code below in order to begin utilizing it: var mysql = require('mysql'); However, upon ...

"Trying to refresh your chart.js chart with updated data?”

Greetings! I have implemented a chart using chart.js and here is the corresponding code: let myChart = document.getElementById('myChart').getContext('2d'); let newChart = new Chart(myChart, { type: 'line', data: { labels: ...

Maintaining duplicate values in a JSON stringify operation: Tips for retention

Server responses are being received in JSON format, which may contain objects with duplicate keys. When displaying the results, I noticed that only the last value for duplicate keys was showing up. After investigating, I realized this was due to using the ...

The color of MUITableHead is being customized using the palette.text.color

I'm having an issue where I want to apply different colors to cells in TableHead and TableBody. Even though I have set a custom theme for both, the color of the TableHead cells is being overridden by palette.text.color. Any ideas on how to resolve th ...

Creating clickable links to MySQL data in Reactjs frontend

Required feature: The project names fetched from the MySQL database and displayed in a table column should serve as links leading to the corresponding information on the /projects page. Current status: Unfortunately, the project names extracted from the M ...

What is the process for integrating Socket io into an external JavaScript file that is connected to an HTML file?

Currently, I am utilizing node js, socket io, and express to develop a multiplayer web game. To begin, the server initiates and listens on port 2000. Upon visiting localhost:2000, the file lobby.html is transmitted using: //app.js const express = require ...

Is it necessary for two sibling elements to be of the same type in order for their margins to collapse together?

I am currently working on enhancing the visual appearance of a Bootstrap 4 card and encountered an issue: https://i.stack.imgur.com/p8Qzhm.png The spacing between the About the gig heading and the top Date item appears to be uneven. I would like to make ...

Incorporate a distinct, unique value from a JSON dataset into each iteration of the .each statement

My code includes an each statement that looks like this: $.each(data, function(i, value) { sublayers.push({ sql: "SELECT " + firstSel2 + ", cartodb_id, the_geom_webmercator FROM full_data_for_testing_deid_2 where " + firstSel2 + "=&ap ...

Display a list of records retrieved from a Firebase query using ngFor to iterate through each instance

I'm currently using firebase and angular to work on a billing list project. The list contains data showing information for a specific month, you can refer to the imagehttps://i.stack.imgur.com/ZR4BE.png While querying the list was smooth, I encounte ...

Generate dynamic lines with evolving hues using CSS3

While working on a fresh web project, I came across the need to emphasize my headers (h1, h2, h3, h4) with underlines. My goal is to have these underlines grow and change color dynamically, similar to what can be seen here: . Is there a way to achieve thi ...

Creating a custom comparison method between two select dropdowns using the jQuery Validation plugin

In my HTML code, I have two select elements: <label for="h_slat_type">Horizontal Slat Type</label> <select name="h_slat_type" id="h_slat_type"> <option disabled="disabled" selected>Select</option> ...

Exploring the benefits of leveraging Express with SSL security features

I recently acquired a Comodo SSL certificate for setting up an SSL server with express. The certificates I have include: AddTrustExternalCARoot.crt COMODORSAAddTrustCA.crt COMODORSADomainValidationSecureServerCA.crt mysite.com.key mysite.com.csr mysite_co ...