Is there a way to wrap label text when using Highcharts Grouped Categories?

Is it possible to wrap my label text or increase the cell height to make it responsive? Check out my jsfiddle example.

See how the labels are overlapping here

Here is the HTML:

<div id="container" class="chart-container"></div>

And this is the jQuery:

$(function () {
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: "container",
            type: "column",
            marginLeft: 85,
            marginRight: 15
        },
        title: {
            useHTML: true,
            x: 10,
            y: 80,
            text: ''
        },
        series: [{
            data: [4, 14, 18, 5, 6, 5, 14, 15, 18]
        }],
        xAxis: {
            style:{
                overflow: 'none',
                crop : false
            },
            min:0,
            opposite:true,
            labels: {
                style: {
                    textOverflow: 'none',
                    whiteSpace: 'nowrap',
                    color: '#000000',
                    fontSize: '11px',
                    overflow: 'none',
                    crop : false,
                },
                gridLineWidth: 1,
                groupedOptions: [ {
                        rotation: 0, // rotate labels for a 2nd-level
                        y:10,
                    }],
                rotation: -90 // 0-level options aren't changed, use them as always
            },
            categories: [{
                name: "Fruiqweqw ewqeqwet",
                categories: ["Appleasd asdadd", "Bananaasd asdsa", "Orange asdad"]
                }, {
                name: "Vegetableasdasd",
                categories: ["Carrot asd", "Potato sdf", "Tomato"]
                }, {
                name: "Fishqwewewqewq",
                categories: ["Codasdsa", "Salmonasd", "Tuna"]
            }]
        }
    });
});

The labels in the x axis are currently overflowing the space provided. I have many labels in my actual project, so fixing the width is not an ideal solution. Any suggestions on how to handle this?

Answer №1

Gotcha, I understand now.

Updated style: {
          width: 15
        }

Adjusting the width should resolve the issue. You can verify it by visiting this link http://example.com/jsfiddle123/

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

How can I eliminate the border from the last child in a row within a responsive framework?

Put simply, I am trying to target not only the last child in a parent div, but also the last item in a row that adjusts based on screen size. I have a row of 4 elements (divs) with borders on all but the last one using :last-child. However, when the screen ...

Modify the values in a textbox using JavaScript to suit your needs

unusual issue: I'm encountering a strange bug with my form. I have an ajax datepicker attached to a text box, but when I submit the form, all values are received except for those from the datepicker checkboxes. Why is the .Text property empty for th ...

In the process of making a request with axios in an express server

Struggling with a simple call to an API using Axios with Express, and I can't figure out why it's always pending in the browser. Here is my route: var express = require("express"); var router = express.Router(); const controller = require("../. ...

Guide on generating a fresh array of objects that encompass distinct items, alongside their combined prices and quantities using JavaScript

I am struggling to generate a new array of objects from one that contains duplicates. For instance, here is the console.log output of the current array: console.log(items); [{ _id: 5eb2f7efb5b8fa62bcd7db94, workName: 'best item ever', ...

Implementing a feature that ensures html elements are transparent in a PDF conversion

I am in the process of converting a webpage into a format that is easily printable as a PDF, while ensuring that it maintains the same appearance. Many tools for printing to PDF do not support background images or colors, so I am attempting to overcome thi ...

Changing a button's value on click using PhoneGap

I've been working with phonegap and came across an issue with my buttons setup like this: <input id="my_button" type="button" onclick="my_function();"/> The goal is to capture the click event and change the button's value, my_function ( ...

Searching for a way to detect when a user clicks the back button on their Android or iPhone device using JavaScript or

In the process of building a Single Page Application (HTML5) utilizing the following plugins: - Sammy.js - Knockout.js - Require.js - Jquery.js This app is designed for Android, iPhone, and Windows mobile devices. Many scenarios revolve around cli ...

"Instant Elementor offers seamless CSS transitions for an enhanced user experience

UPDATE: Issue resolved, discovered that Elementor was overriding certain styles. Please refer to my solution below. I'm attempting to add animation to a simple max-height property of a div, but the transition isn't working as expected. It transi ...

What is causing Node to mistake my MongoDB model for a module?

I've set up a basic MERN project with a UserModel included. import mongoose from "mongoose" const UserSchema = new mongoose.Schema({ name: String, email: String, password: String }) const UserModel = mongoose.model('Users', ...

Utilizing the MEAN stack to establish a connection with a simulated data collection

Currently, I am diving into the world of M.E.A.N stack development. As part of my learning process, I have successfully set up a test page where Angular.js beautifully displays and re-orders data based on search criteria. To challenge myself further, I dec ...

Guide on implementing Content Security Policy (CSP) for smartsupp chat in Yii2

Currently, I am utilizing the Yii2 https://github.com/tomlutzenberger/yii2-smartsupp-chat widget and it is functioning quite well. However, I have encountered an issue where it is unable to record videos on their website. The solution suggested by them is ...

Submitting a JavaScript array to MongoDB using a React application: A guide to success!

As a beginner delving into the world of React and MongoDB, I'm encountering difficulties in establishing communication between the two technologies. Recently, I've been following a detailed tutorial on Medium that focuses on utilizing the Plaid A ...

What is the method for retrieving array input data with jQuery?

Here is an example of my input field: <input type="hidden" name="data[{{ $parentIndex }}][{{ $index }}]" value="{{ $value }}"> Sample data provided below: <input type="hidden" name="data[0][0]" ...

The essence of space remains intact within my front-end content

Here is the JavaScript code snippet I am using for keyHandler on the front-end: let snippet = document.getElementById('snippet'); let remaining = document.getElementById('remaining'); let typed = document.getElementById('typed&ap ...

What purpose does this particular express variable serve?

I am currently diving into the world of JavaScript, with a basic programming background to boot. However, I have always stumbled when it comes to grasping OOPs concepts. For instance, we start by importing what I believe is the express module through &apo ...

What is the best way to hide the next/previous tabs once the jQuery dataTable has been set up using jSON data

Setting up a jQuery table using JSON data. Despite knowing that there will only be one row, the next/previous tabs are still displayed after the table. Is there a way to remove them? Here is the code for the table: table = $("#retrievedTable").dataTabl ...

What is the best way to convert an array of data into a dataset format in React Native?

Within my specific use case, I am seeking to reform the array structure prior to loading it into a line chart. In this context, the props received are as follows: const data = [26.727, 26.952, 12.132, 25.933, 12.151, 28.492, 12.134, 26.191] The objective ...

How can I trigger onClick using VBA within HTML script?

Is there a way to trigger the onClick event in an HTML page? I found this code by searching on Google: <img src="Imagens/lupa.gif" alt="Search Folder" class="img" onclick="locate();"> Currently, this is my VB ...

When is the best time and place to break out Yahoo's Mojito Manhattan cocktail mix?

Yahoo! made headlines earlier this month by unveiling their new Mojito framework, set to be open sourced in 2012. I've been eager to learn more about this promising framework but haven't had any success so far. Does anyone know where I can find ...

ReactJS: Oops! Looks like there's an issue with the element type - it's invalid. We were expecting a string

I am in the process of setting up a basic server-side rendered React application. Listed below are the steps I have taken: Step 1: Creating a new React app using create-react-app: npx create-react-app my-ssr-app Step 2: Installing necessary dependencies: ...