score:2
Yep, there is a workaround. You can achieve this by using the attr() function of jQuery. When you click on the rectangle you change the stroke-width attribute.
Still I think this is a good point to report perhaps as a bug of the API?
Anyways the JS code will look like this:
$(function () {
var renderer = new Highcharts.Renderer(
$('#container')[0],
400,
300
),
rect = renderer.rect(100, 100, 100, 100, 5)
.attr({
'stroke-width': 2,
stroke: 'gray',
fill: 'silver',
zIndex: 3
})
.on('click', function () {
rect.animate({
x: 50,
y: 50,
width: 200,
height: 20
})
$("rect").attr("stroke-width", "30"); // here you can change the stroke-width
})
.add();
});
To see it in action here the adjusted JSFIDDLE
VERSION 2
Based on your comment I edit the code. In this case you set also an animation for the stroke-width. This is a simple solution. Another solution would be tweaking the original Highcharts library which I would not recommend. Anyways, hope it helps:
$(function () {
var renderer = new Highcharts.Renderer(
$('#container')[0],
400,
300
),
rect = renderer.rect(100, 100, 100, 100, 5)
.attr({
'stroke-width': 2,
stroke: 'gray',
fill: 'silver',
zIndex: 3
})
.on('click', function () {
rect.animate({
x: 50,
y: 50,
width: 200,
height: 20
})
$("rect").animate(
{ "stroke-width": "10" },
{
duration: 500,
step: function(now) { $(this).attr("stroke-width", now); }
});
})
.add();
});
The duration can be adjusted to what is suitable for you. See it in action here: JSFIDDLE
Source: stackoverflow.com
Related Query
- Animate stroke-width with Highcharts renderer
- Column width in Highcharts when combined with spline
- Highcharts scatter plot with variable line width
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts - Highstock: fixed width intervals with scrollbar
- when printing page with highcharts using javascript this.print() width values in css in @media print seem to be ignored
- passing formatting JavaScript code to HighCharts with JSON
- Issue with last column width in Highcharts
- Highcharts multiple x axis and yaxis. The width of the 1st x-axis is not in sync with browser resize
- Changing bar width with pointPadding in Highcharts
- Highcharts custom pattern fill shows different stroke width
- Highcharts series visibility with csv data source
- Highcharts Angular - How to set chart width and height with percentages?
- How to have multiple highcharts with different series data in vuejs without repeating code
- Not able to animate solid gauge chart with Angular Highcharts
- Why code of Horizonal line(y-axis) on a single in Highcharts get applied to all other charts integrated with Webdatarocks
- Highcharts cloud issue with data source when duplicating chart
- Getting numbers on Y-axis to show up as percentages with code from a Highcharts code generator tool?
- correct positioning with Highcharts renderer on a bar chart
- How to reduce the space between Bars with a fixed bar width in Highcharts column chart?
- Width for labels on x Axis with grouped Categories in Highcharts
- Highcharts - sync crosshair of charts with different width
- Highcharts column width with variable x axis point spacing
- Highcharts code with same set of code/data works in PHP but does not work in JSfiddle
- Reload chart data via JSON with Highcharts
- Highcharts - how to have a chart with dynamic height?
- Highcharts - issue about full chart width
- Highcharts width exceeds container div on first load
- Maximum bar width in Highcharts column charts
- Resize height with Highcharts
More Query from same tag
- Highcharts: How to extend the x axis beyond the last column
- Threshold value change on click of rangeSelector in HighStock graph
- Race condition leading to Highcharts error #13
- How Do I put Multiple Charts on the Same Graph rCharts High Charts
- Highcharts component that creates secondary yAxis based on props.boolean
- To store date after using afterSetExtremes of Highcharts.stock
- highcharts - add label by custom id
- How can I create a weighted pyramid chart (looks like a pie chart)?
- Highcharts (JavaScript): Change color of column if condition is met
- Click event not fire in highcharts tooltip
- Limit number of points in a series in Highcharts
- Highchart showing up empty until button click
- How to set Highcharts chart maximum yAxis value
- Enabling scroll bar on y-axis of the high charts heatmap showing up some additional y-axis labels
- Draw deadlock graph(using functions) and added ability for scaling
- show custom date on xAxis in highstock lineseries
- Multiple intervals in columnrange chart Highcharts
- linecap property in highchart doesn't work
- Highcharts allowDecimals condition
- Manage multiple highchart charts in a single webpage
- HighCharts - getJson to HighCharts dual axes
- Stacked, grouped column chart with variable width of x points
- What format does the highcharts js library accept for dates?
- maxPadding doesn't work for Highstock
- afterSetExtremes callback for highcharts
- Chart rendering issue when hiding all series via clicking on legends
- container .fadeIn/Out with HighCharts and Leaflet
- Load highcharts data with laravel and ajax
- How do I add an event listener to a Highcharts object *AFTER* I've created it
- Sitecore 8 experience editor and jquery