Customize the border width and color of a specific column in HighCharts based on dynamic data

I am looking to dynamically change the border width and color of only one column in a basic column chart. Here is an example:

var chartingOptions = {
chart: {
    renderTo: 'container',
    type: 'column'
},
xAxis: {
    categories: ['5:1', '4:1', '3:1', '2:1', '1:1', '1:2', '1:3', '1:4', '1:5']
},
plotOptions: {
    column: {           
      grouping: false
    }
},
series: [
    {
    name: 'Serie 2',
    data: [20, 24, 30, 40, 60, 80, 90, 96, 100]},
{
    name: 'Serie 1',
    data: [100, 96, 90, 80, 60, 40, 30, 24, 20]}
            ]
};

var chart = new Highcharts.Chart(chartingOptions);

Check out JSFIDDLE here.

I attempted to modify it directly for the first series by using:

chart.series[0].data[2].series.borderColor = 'black'

However, the series did not update. Any suggestions would be appreciated!

Answer №1

To modify the SVG element, you must adjust the properties for stroke and stroke-width.

For instance, check out this example: http://jsfiddle.net/abc123xyz/4/

Answer №2

To change the color of a column in a chart, use <code>chart.series[0].data[2].series.color = 'black'
. Please note that this will also affect the color of the tooltip.

If you want to explicitly set the color of individual columns, you can do so like this:

data: [{
    name: 'Point 1',
    color: '#00FF00',
    y: 0
}, {
    name: 'Point 2',
    color: '#FF00FF',
    y: 5
}]

For more information, visit this link.

You can also check out this [fiddle] here.

Answer №3

The borderColor and borderWidth options are specific to series objects and cannot be used with data objects. For more details on this, please refer to the documentation provided in the link above.

If needed, you can manually add borderColor and borderWidth properties to data objects by editing the source code of highcharts.js.

I hope this information is useful to you.

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 prolong TypeScript document

As I develop a drag and drop interface, upon dropping a file, the native File is retrieved. To enhance this interface with additional information, I decided to explore various approaches. In my initial attempt, I utilized: interface AcceptedFile extends ...

Utilizing Node.js and Jasmine: Preventing the invocation of a Promise function to avoid executing the actual code results in DEFAULT_TIMEOUT_INTERVAL

There is a function below that returns a promise. public async getAverageHeadCount(queryParams: Params, childNode: any, careerTrackId: string): Promise<Metric> { const queryId = this.hierarchyServiceApiUrl + "rolling-forecast/ahc/" + q ...

The error message "Each item within a list must be assigned a unique 'key' prop" is being displayed

At the moment, I'm immersed in a project that utilizes React, Next.js, and Ant-Design. However, during the development process, I encountered an error due to the absence of a unique key like so: Here's the detailed log of the error: Warning: Ea ...

Breaking down classes and cross-referencing them with a different DIV using JQuery

Trying to create a variable named relatedBoxes that will store checkboxes sharing similar classes as the box div. To do this, I am splitting up the classes and storing them in a variable called splitClass. Now, all that's left is to find out if any o ...

Convert the jade file to an HTML file while keeping the original file name

I'm currently attempting to configure Jade in a way that allows me to save my Jade files as HTML files while retaining the same file name. For example, I would like the file views/index.jade to be saved as dist/index.html This should apply to all ad ...

Access the keys of a Flow object type within your codebase

Is it feasible to extract keys from a Flow object type definition within the application code (in other words, are Flow type definitions reflected in any way in the runtime code)? Scenario: type Props = { userID: string, size: number | PhotoSize, s ...

Modifying the sidebar navigation in Ionic for a user who is logged in

Is it possible to modify the side menu content based on whether a user is logged in or not? Example 1 - user not logged in: If a user isn't logged in, this side menu will be displayed. https://i.stack.imgur.com/iY427.png Example 2 - user is logged ...

php send back a JSON containing an error message using AngularJS

I am a beginner with PHP and AngularJS, I have written some PHP code that can return JSON data in the following format: {id:10, sessionName:99, computer:99, quality:LAN(very fast), networkAuthentication:Disable,…} {id:13, sessionName:55, computer:55, q ...

JavaScript: protecting data, revealing functionality

Looking to enhance my understanding of Javascript basics in order to delve into client-side frameworks like Knockout and Angular, as well as make headway in learning Node.js. I've selected a simple problem used in teaching C# and am now attempting to ...

Navigating through HTML content and extracting specific elements

After using an ajax call to retrieve the partialView HTML of a page, I need to extract information from the main div before displaying it. This data specifically relates to the size information in order to create a floating window. Here is the code snippe ...

Troubleshooting issue with applying hover effect to child divs

How come when I hover over one of the child items in my parentDiv, the background of the last childDiv changes no matter which child I place my mouse on? for (let i = 0; i < Number(height); i++) { for (let j = 0; j < Number(width); j++ ...

Retrieve the Firepad textarea element or the current character being typed

I'm looking to add hashtag functionality to Firepad using jQuery. Is there a way to access the textarea element or the character being typed in the Firepad editor? For example, can I trigger an event when typing '#'? I attempted to use the ...

"Exploring the best way to retrieve the angular filter value within a Node.js environment

Currently, I am facing an issue with accessing the value in Node.js using req.body when it is stored in ng-model. The ng-model includes an AngularJS filter, and I need to retrieve this filtered value from the input field in Node.js through req.body. Below ...

Displaying an IP camera feed on a three.js canvas

I've been presented with a seemingly straightforward task in JavaScript that I'm not very familiar with. The challenge is to take an IP camera stream and display it on a three.js canvas. To start, I came across an example that uses a webcam inst ...

What is the process for getting non-event javascript instructions to function properly once a DOM element has been added

After inserting DOM elements (such as an AJAX response), event-delegation is necessary to ensure that events work properly. But what about basic JavaScript instructions? All instructions are organized by affected PHP page to simplify code updates and avoi ...

SCRIPT5007: The property 'href' cannot be assigned a value as the object is either null or undefined

This script is functioning properly in browsers like Chrome and Firefox, however it is encountering issues when used with Internet Explorer. An error message is displayed in the IE console: SCRIPT5007: Unable to set value of the property 'href': ...

The input tag contains an empty Request.Form

My issue lies in using Request.Form to retrieve text from an input field, as the value always ends up being empty. My goal is to extract the text value from the input tag and use it to query my database. I have attempted to write to an ASP TextBox but enco ...

Timing issues with setInterval and setTimeout are causing them to execute at the incorrect moments

I am struggling with changing the background image using setInterval and setTimeout every x seconds. The issue I am facing is that the timer is not working as intended, causing images to change instantly instead. let images = ['background1.jpg&apo ...

What could be the reason behind Next.js attempting to import a non-existent stylesheet?

Lately, I've come across an issue where Nextjs is attempting to import a non-existent stylesheet (refer to the images below). I'm looking for guidance on how to resolve this error. Hoping to find a solution here, thank you Web browser console W ...

Guide on restricting the character count and displaying the leftover characters using PHP with Ajax

I've been working on implementing a feature to display the remaining characters in a PHP AJAX call. I was successful using JavaScript, but I'm having trouble doing it with AJAX in PHP. Can someone provide assistance? <script type="text/javasc ...