Adjust the height setting of the React-Highcharts viewport

My initial configuration for highcharts looks like this:-

function getInitialHighChartsConfig(chartType) {
  return {
    credits: false,
    chart: {
      type: chartType,
      height: 325,
    },
    title: {
      text: '',
      useHTML: true,
    },
    yAxis: {
      title: {
        text: '',
      },
      allowDecimals: false,
    },
    xAxis: {
      title: {
        text: '',
      },
      allowDecimals: false,
    },
    plotOptions: {},
    series: {},
  };
}

The height has been set to 325. This results in an SVG Element like below

<svg version="1.1" class="highcharts-root " style="font-family:&quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, Arial, Helvetica, sans-serif;font-size:12px;" xmlns="http://www.w3.org/2000/svg" width="1120" height="325" viewBox="0 0 1120 325">

I would like the height to be 400 instead of 325 while keeping the viewbox as it is. Is there a way to achieve this?

Answer №1

To modify the boxWrapper attributes during the render() chart event, follow this example:

  chart: {
    height: 400,
    events: {
      render() {
        let chart = this;
        chart.renderer.boxWrapper.attr({
          viewBox: '0 0 ' + chart.chartWidth + ' ' +
            325
        });
      }
    }
  }

See it in action: https://jsfiddle.net/BlackLabel/z0qg9ow7/

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

Unable to retrieve information from the json-server

For my current project in Backbone.js, I'm utilizing the json-server package to populate it with data. I've created a db.json file containing the data and executed the command json-server --watch db.json. The server started successfully and is ru ...

Utilizing React Native Camera Kit allows for the seamless and continuous scanning of QR codes, offering multiple callbacks when a code is

Attempting to integrate a QR code scanner into my project using react native. Utilizing the plugin react-native-camera-kit, which supports both QR and Bar code scanning. However, I am facing an issue where the scanner continuously scans the code and trig ...

Loading Textures in Three.js Using async / await is the Way to Go

Recently, I took a Drawing class and learned about creating objects: export class Drawing { constructor(texture) { const material = new MeshBasicMaterial({ color: 0xffffff, map: texture }); this.m ...

Tips for adjusting the content direction of a Popover

I am currently working on a component that includes the following code: import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Portal, Button, } from "@chakra-ui/react"; import { ReactNode } from "react"; import { Co ...

Center Items in Flexbox, Implementing React Material with React

In my React App, I am utilizing flexbox and React Material to align the searchbar and clear button on the same line with space between them. Here is the link for reference: CLICK HERE <div className={classes.searchBarSection}> <Paper com ...

Tips for eliminating empty trailing values and Carriage Returns from a JavaScript array

I needed a way to eliminate empty elements and Carriage Returns from the end of an array. Here's an example of what my array looks like: Input arr: ['', 'Apple', '', 'Banana', '', 'Guava', & ...

Vue automatically populates an empty array with an Observer object

I have been attempting to create an empty array in the data and then fetch a JSON from the server to populate it. The issue I am encountering is that the array consistently includes an extra Observer object, so when I log it, I see: empty items array: ...

Is it possible to invoke React's useState and useCallback multiple times within a singular functional component? And if it is, how exactly does the process function?

After scouring the official React documentation and various blog posts, it seems there is no mention of this particular query. In my opinion, it could be beneficial to structure multiple state variables in a component like so: function MyComponent() { ...

How can the animation of Material UI expansion panel be turned off?

Is there a way to turn off the animation for Material UI expansion panels in React? I'm trying to disable all animations on the panel. Any tips on how to achieve this? I attempted to overwrite the transitions, but it didn't work as expected. How ...

Simple way to automatically reload your script using an npm server

Testing out a sample javascript code snippet. Locating a script named simple.js in the demos directory. Executing the demo using the command yarn build-demos && http-server demos/ The script simple.js is compiled to simple_bundle.js and the serv ...

Mastering the art of utilizing AJAX for autocomplete functionality

While utilizing the autocomplete feature from jqueryui (http://jqueryui.com/autocomplete/#remote) and fetching data from "source: "search.php"" The following script ... $( "#name" ).autocomplete({ source: "search.php", minLength: 2, select: function( ...

Change the view using React before scrolling to a specific element on the page

How can I create a link from one view to another and scroll to a specific element without any animations? The transition between views is through react router. Is it possible to pass references to elements for scrolling, or is there a better approach? Be ...

Issues with Autofocus in AngularJs on Firefox

Check out this straightforward directive to set autofocus: app.directive('autoFocus', function($timeout) { return { restrict: 'AC', link: function(_scope, _element) { $timeout(function(){ ...

When using React, it's important to verify if the page has been refreshed before updating the local storage based on the GraphQL query. If the page

Currently, I am working on implementing a hit counter feature that increments each time a user clicks a button. The setup involves GatsbyJS with React and utilizes a lambda function to store the count in FaunaDB. Additionally, the client-side functionality ...

Show a success message, clear the post data, and redirect back to the current page

I have a single web page with a contact form. When the form is submitted, I want it to redirect to the same page and display a success message that fades out after a few seconds. Additionally, I want the post data of the form to be cleared. The form also i ...

Secure access with Next.js, next-auth, and backend with Node.js

Once a user is logged in on the frontend using next-auth and Next.js, my goal is to transmit the cookie generated by next-auth to the backend Node.js for validation before allowing the user to perform actions such as adding posts. The main objective is to ...

How can Vue JS 3 components exchange data between each other?

I am attempting to share data from a variable favorite_count in the Favorites component located in the file Favorites.vue. My goal is to pass this data to the App Component in the App.vue file but I have been unsuccessful so far. I want any changes made to ...

Is it feasible to incorporate an external library as a script within a class or functional component in React?

Welcome and thank you for taking the time to read this question! I am currently working on a project where I need to load a TIFF image. After researching, I found a library that can help with this task: https://github.com/seikichi/tiff.js There is also ...

VS Code lacks autocomplete intellisense for Cypress

I am currently using Cypress version 12.17.1 on VS Code within the Windows 10 operating system. My goal is to write Cypress code in Visual Studio Code, but encountered an issue where the cypress commands that start with cy are not appearing as auto-comple ...

Refining/searching with selectors in AJAX response

As someone who is new to javascript and coding in general, I am facing a challenge with filtering and manipulating data received through an AJAX request. Unfortunately, I do not have access to the server-side code. The server responds with rota information ...