highcharts context menu hidden for small charts - highcharts

I am migrating a dashboard type screen to highcharts and would like to use the default context menu (for exporting various image formats and printing the chart).
The problem is that a lot of these charts are small gauge type charts and the context menu gets hidden when charts get below a certain size, mainly due to the fact that the context menu appears above the button for small charts size.
Is there anyway to make the context menu always appear below the button? I know I can limit the options and this will solve the problem but I would ideally like to use the default options list. Also I don't really want to have to calculate positions and move it myself.
See jsfiddle
see code at jsfiddle

Add the following styles to the context menu.
.highcharts-contextmenu {
bottom: auto !important;
top: 5px;
}
FIDDLE

Not sure if it would work for your situation, but have you considered using their pie chart with the legend at the bottom?
http://www.highcharts.com/demo/pie-legend

Related

Charts in Vaadin14 don't seem to automatically resize when in splitlayout windows

In Vaadin 14.4.2, I have a scenario in which I have added a chart inside a splitLayout. However, when I, as a user, expand or shrink the splitLayout, the corresponding chart does not resize. The other components, such as the grid do automatically resize. Is there some "magic" configuration option to get the chart to behave like other components? (The screenshot below shows the chart not having resized, even though the grid beneath it did properly automatically resize.) (Also fyi, I call this: spectraChart.setSizeFull(); so the chart should be using up all the available space.) (Another FYI: I could probably "trap" the splitLayout resize even then redo the plotting, but it seems to me that this should ideally not be necessary in the a 'framework' solution such as Vaadin, since a chart is a component that should behave like other components, such as the grid.)
Yes, unfortunately that is true. You can workaround the issue by doing explicit JavaScript call to Charts to reflow when splitter position has been changed. The code snippet below finds all charts and reflows them:
innerLayout.addSplitterDragendListener(event -> {
getUI().ifPresent(
ui -> ui.getPage()
.executeJavaScript(
"Array.from(window.document.getElementsByTagName('vaadin-chart')).forEach( el => el.__reflow());"
));
});

Highcharts and OpenLayers not rescaling after Bootstrap layout change

In my Angular 2 environment, the OpenLaysers and Highcharts components are not rescaling themself after I change the Bootstrap layout. If I click on my button that changes the Bootstrap grid classes, the components should rerender. I tried rerendering the charts through highcharts.redraw() function - that does not fix the problem. As visible in the video, if I press 'F12' and go into 'Developer Tools' (showing as a black box at the bottom - 0:08), the components redraw. Therefore I tried workarounds like giving the body a zoom of 2.0000.1, new zIndex, different height, display 'none' - 'block'. Nothing works.
In Highcharts you should use chart.reflow() not chart.redraw(). Alternatively, you can use chart.setSize(newWidth, newHeight).

Dynamic Vaadin chart

Is there a way to modify a Vaadin chart by moving a bar or a point from the chart itself? i.e. I have a bar chart with a certain value in one of the bars, I want to get a new value by dragging that bar to that new value.
There is something similar in this example, that is why I wonder if it is possible to extend this option to something like what I need.
Thanks!!!!
I assume that vaadin uses Highcharts if this is the case, maybe you can use plugins, if so I recommend:
http://www.highcharts.com/plugin-registry/single/3/Draggable%20Points
Source code in case you had to rewrite it:
https://rawgit.com/highslide-software/draggable-points/master/draggable-points.js
Regards.

disable legend resizing of chart

Does anyone know the setting in highcharts (I've looked through the API but I can't seem to find it - maybe looking in the wrong place?) where I can disable the chart's ability to resize when I click on a legend item?
http://api.highcharts.com/highcharts#legend
If there are two lines on the graph, and toggle off one of them on the legend, the graph resizes to show the one line full sized. I want to prevent this functionality.
There actually is a simple solution to this provided for by the API:
chart: {
ignoreHiddenSeries: false
}
I'm pretty sure this is the behavior you desire.

When I click on first pie on the page, the second appears, but then I cannot do anything with the first

Like stated in the title, I got the problem when I click on some slice of pie. I call function, which displays hidden div with the second pie. It appears correctly, but then I cannot click on that first pie and even tooltips are not displaying. And the second pie is all black, but that is the lesser problem, I think... Thanks for advices in advance!
Here's your fiddle with my changes: jsFiddle.
To fix hover and click events on first chart, I've deleted position: relative of second container.
To fix issue with black colors, I moved colors declaration into Highcharts.Chart({...}). Otherwise, you'll re-rewrite Highchart colors while creating the second chart.

Resources