I am having problem with bootstrap gutter x-axis - bootstrap-5

When i am using row, gutter y-axis is working fine but gutter x-axis isn't working not even working with css3. How to solve the issue?
<div className='row container'>
{
collections.slice(0, 6).map(collection =>
<Collection
key={collection._id}
collection={collection}
></Collection>)
}
</div>

Related

How to paint primefaces pie charts with huge legends?

I want to paint some pie charts with huge legends, but I can't resize the yellow panel in the background of the pieChart.
Is there any way to resize the yellow panel to put the legend below and not resizing the piechart itself?
Piechart without legend:
Piechart with legend:
Here I let you my piechart code (I am using primefaces 4.0):
<p:panel style="width: 600px; height:500px;">
<p:pieChart value="#{pieModel.value}" title="#{pieModel.key}" showDataLabels="true" extender="pieExtender" legendPosition="s" legendCols="6" />
</p:panel>
I have tried to play with panel styles, but it was useless.
EDIT (after kukeltje comment):
I have searched in jqPlot documentation, but I haven't found anything. What are the jqplot properties for changing this panel size. Or maybe I need an extension?. No idea.Please, show me an example... I just found a way to show labels when moused over, and I figured out it could be something similar, but not come upon the background panel size:
<script type="text/javascript">
function pieExtender() {
this.cfg.highlighter = {
show: true,
tooltipLocation: 'n',
useAxesFormatters: false,
formatString: '%s = %d'
};
}
</script>
I have solved the problem defining the style of the chart, and I have to calculate how big will be the legend, bring the width and height to the pieChart component:
This is not the best solution, because it is quite impossible calculate the exactly panel size to keep the pie chart size as without legend, but at least I can keep the pie visible...

Highcharts width exceeds container div on first load

I'm using Highcharts with jQuery Mobile.
I have an area graph being drawn within a jQM data-role="content" container and within that container I have the following divs:
<div style="padding-top: 5px; padding-bottom: 10px; position: relative; width: 100%;">
<div id="hg_graph" style="width: 100%"></div>
</div>
My highcharts graph is a basic graph taken from one of their examples where I have not set the chart width property.
On the first load the graph exceeds the width of the containing divs, but when I resize the browser it snaps to the appropriate width.
How can I make it so that the width of it is right on first page load and not just on resize?
I've reviewed similar posts on stack overflow and none of the solutions seem to work.
UPDATES
I've identified the problem is that the dynamically generated <rect> tag by Highcharts is taking the full width of the browser window on page load and not taking it from the containiner div width at all. Here's the html generated when I inspect:
<rect rx="5" ry="5" fill="#FFFFFF" x="0" y="0" **width="1920"** height="200"></rect>
I tried to reproduce in JSFiddle, but it seems to work fine there, which really has me stumped. Here's my JSFiddle code: http://jsfiddle.net/meandnotyou/rMXnY
To call chart.reflow() helped me.
Docs: http://api.highcharts.com/highcharts#Chart.reflow
this works like magic
put in your css file following
.highcharts-container {
width:100% !important;
height:100% !important;
}
I have the same problem, in my case had a graph of highchart that it is shown after click a button. I put $(window).resize(); after show event and it solved the problem correctly. I hope you serve.
Set width of the chart. That's the only option that worked for me.
chart: {
type: 'line',
width: 835
},
Define the highcharts inside the document ready:
<div style="width:50%" id="charts">
and the script:
$(document).ready(function(){
$(#chart).highcharts(){
...
});
)};
Hope it works ;)
I had a similar issue with centering the highcharts graph it gave. It would center and size correctly for some resolutions but not all. When it didn't, I had the exact same symptoms you're describing here.
I fixed it by attaching/overriding additional css to the highcharts default.
so in a custom css file, adding
.highcharts-container{
/** Rules it should follow **/
}
should fix your issue. Assuming that your div "hg=graph" has nothing but highcharts.
For those using angular and custom-built components, remember to define a dimensioned display in css (such as block or flex) for the host element.
And when the chart container has padding, you might find this indispensable:
html
<chart (load)="saveInstance($event.context)">
...
</chart>
ts
saveInstance(chartInstance: any) {
this.chart = chartInstance;
setTimeout(() => {
this.chart.reflow();
}, 0);
}
Otherwise the chart will bleed past the container on load and get its correct width only at next browser reflow (eg. when you start to resize window).
The best way is to call chart.reflow in render event function documentation;
Highcharts.stockChart( 'chartContainer', {
chart: {
events: {
render: function() {
this.reflow();
}
},
zoomType: 'x',
...
},
and remember to set min-width to zero and overflow to hidden in chart container.
#chartContainter {
min-width: 0;
overflow: hidden;
}
I just ran into the same problem today - not on mobile, but with a window sized small on first page load. When the page loads, the chart is hidden, then after some selections on the page, we create the chart. We have set a min-width and max-width for the container in css, but not a width.
When the chart is being created, it needs to determine the dimensions to create the SVG . Since the chart is hidden, it cant get the dimensions properly so the code clones the chart container, positions it off-screen and appends it to the body so that it can determine the height/width.
Since the width is not set, the cloned div tries to take as much space as it can - up to the max-width that I had set. The SVG elements are created using that width, but added to the chart container div which currently is smaller (based on the size of the screen). The result is that the chart extends past the container div's boundaries.
After the chart has rendered the first time, the on-screen dimensions are known and the clone function is not called. This means that any window resizes, or reloading of the chart data cause the chart to size correctly.
I got around this initial-load problem by overriding the Highcharts function cloneRenderTo which clones the div to get dimensions:
(function (H) {
// encapsulated variables
var ABSOLUTE = 'absolute';
/**
* override cloneRenderTo to get the first chart display to fit in a smaller container based on the viewport size
*/
H.Chart.prototype.cloneRenderTo = function (revert) {
var clone = this.renderToClone,
container = this.container;
// Destroy the clone and bring the container back to the real renderTo div
if (revert) {
if (clone) {
this.renderTo.appendChild(container);
H.discardElement(clone);
delete this.renderToClone;
}
// Set up the clone
} else {
if (container && container.parentNode === this.renderTo) {
this.renderTo.removeChild(container); // do not clone this
}
this.renderToClone = clone = this.renderTo.cloneNode(0);
H.css(clone, {
position: ABSOLUTE,
top: '-9999px',
display: 'block' // #833
});
if (clone.style.setProperty) { // #2631
clone.style.setProperty('display', 'block', 'important');
}
doc.body.appendChild(clone);
//SA: constrain cloned element to width of parent element
if (clone.clientWidth > this.renderTo.parentElement.clientWidth){
clone.style.width = '' + this.renderTo.parentElement.clientWidth + 'px';
}
if (container) {
clone.appendChild(container);
}
}
}
})(Highcharts);
I saved this function in a separate script file that loads after the Highchart.js script has loaded.
try and encapsulate the highchart generation inside a pageshow event
$(document).on("pageshow", "#hg_graph", function() {...});
I resolved this problem (for my case) by ensuring that the containing UI elements render before the chart, allowing Highcharts to calculate the correct width.
For example:
Before:
var renderChart = function(){
...
};
renderChart();
After:
var renderChart = function(){
...
};
setTimeout(renderChart, 0);
I have been having this issue too, and the .highcharts-container css solution wasn't working for me. I managed to solve it for my case by splitting out an ng-class condition (which was setting different widths for the container div) into separate divs.
eg, this
<div ng-class="condition?'col-12':'col-6'">
<chart></chart>
</div>
into
<div ng-show="condition" class="col-12">
<chart></chart>
</div>
<div ng-show="!condition" class="col-6">
<chart></chart>
</div>
I couldn't really tell you why it worked though. I'm guessing the ng-class takes longer to calculate the container width and so highcharts renders first with an undefined width? Hopefully this helps someone anyway.
I also have the same issue in my app where i am using angular
and i also using ngCloak directive which i have removed as i don't need it
after doing this my problem is solved.
I have just seen that sometimes there are several issues going on at the same time.
If it happens the height exceed the expected heigh:
SCSS style:
.parent_container{
position:relative;
.highcharts-container{position: absolute; width:100% !important;height:100% !important;}
}
If the width exceeds the container (bigger than what's supposed to) or does not resize properly to smaller one:
let element = $("#"+id);
element.highcharts({...});
// For some reason it exceeds the div height.
// Trick done to reflow the graph.
setTimeout(()=>{
element.highcharts().reflow();
}, 100 );
The last one happened to me when destroying the chart and creating a new one... the new one was coming with width extra size.
I have been also bump into this issue. both affected in desktop and mobile view of the chart.
In my case i have a Chart that update the series color depending on min or max.After updating the points, the highcharts width exceeds container div on its first load.
To fix that, what i did is add chart.reflow(); after the update of points.
CODE:
//First declare the chart
var chart = $('#TopPlayer').highcharts();
//Set the min and max
var min = chart.series[0].dataMin; //Top Losser
var max = chart.series[0].dataMax; //Top Winner
for (var i = 0; i < chart.series[0].points.length; i++) {
if (chart.series[0].points[i].y === max) {
chart.series[0].points[i].update({
color: 'GREEN',
});
}
if (chart.series[0].points[i].y === min) {
chart.series[0].points[i].update({
color: 'RED',
});
}
}
// redraw the chart after updating the points
chart.reflow();
Hope this helps to those who has the same issue like me. :)
Here's a solution that worked for me ! The charts were working fine for a while and then after a feature they started exceeding their container. Turns out it was the defer attribute on the script in the head of my application.
Try removing defer on your javascript tags:
<script defer src="script.js"></script>
to
<script src="script.js"></script>
Or moving my stylesheet link higher in the head also seemed to fix it but it's a less reliable solution..
This may have been introduced since the OP in 2013, but you should be able to set height with chart.height (https://api.highcharts.com/highcharts/chart.height)
options: {
chart: {
type: 'bar',
height: window.innerHeight + 'px',
},
title: {
text: 'Top 10 Users',
},
subtitle: {
text: 'by scores',
},
This is a web based solution, but I would expect you could cater it to jQuery.mobile
None of the answers helped me. I dynamically change chart data and the top answer solution ruins the animations and causes a jump in the chart position.
The workaround that I finally came up with was to set some padding for the chart wrapper element (in my case some part of the chart to left was hidden, so I gave some left padding), and then set the chart main element overflow property to visible. It works and the animations are just fine. You may need some experimenting with padding value to get it perfectly displayed.
<div class="chart-wrapper">
<!-- high charts main element here -->
</div>
and the style
.chart-wrapper{
padding-left: 20px;
}
.chart-wrapper > div:first-child{
overflow: visible !important;
}
for me, I set chart width:
$('#container').highcharts({
chart: {
backgroundColor: 'white',
**width:3000**,
..... }
and in html set overflow:auto
<div id="container" style="**width:100%;overflow:auto**;" ></div>
I struggled with this for way too long, and found a solution that works for me. A little bit of background on my setup:
The highcharts chart was loading on a tab on my website that is not visible upon logging into the site.
When switching to that tab, the chart was well outside the div.
So, I attached a unique ID to that particular tab, we'll call it tab5, and then bound a click function that forced - and this is the important part - the <svg> element within the container div to 100% using jQuery:
$('#tab5').bind('click', function() {
$('#container_div svg').width('100%');
});
...and my sanity has been restored. For the moment.
Please add width:100% to chart container.
Hope this will resolve overflow:hidden related issue.
classname{min-height:450px;width: 100%;}

Highcharts tooltip is hidden behind other charts

When putting multiple charts tooltips from upper charts are hidden behind others.
I found some tips on how to it but nothing helped.
Is there anyway to keep tooltips on top of charts?
The example is here: http://jsfiddle.net/Zw3uM/
Thanks a lot!
This is pure html : Any div element loaded after ( meaning appearing after on the html page) will always be in front.
In order to get the first chart tooltip be in front of the second : load the second in first and set its y position on the page using an absolute or relative position in css :
I've change their order, putting the container2 in first in html:
<div id="container2" style="height: 200px"></div>
<div id="container1" style="height: 200px"></div>
Then set the position of container2 to be under the first one (thanks to the top style attribute) :
div[id="container2"] {
position:absolute;
top:200px;
}
Here is the result : http://jsfiddle.net/Zw3uM/3/
You can use tooltip pisitioner:
http://api.highcharts.com/highcharts#tooltip.positioner
The problem is due to each highchart container having its own stacking context. This is because the highcharts-container has both position: relative and z-index: 0 (css dynamically applied by the highcharts library).
So the z-index of the tooltip has meaning only in its parent highchart container.
To fix this we need to override the (z-index: 0) rule for the highcharts-container using the following:
.highcharts-container
{
z-index: auto !important;
...
}
This way all hightcharts-containers & their children would share the same stacking context and their z-indices would apply the desired effect.
You can check the fix here: http://jsfiddle.net/w5bLo1cw/4/

highcharts legend entries not clickable in firefox

I have several highcharts graphs set up and have recently noticed that I'm unable to click on legend entries to show/hide their associated series in Firefox. This works fine in Chrome and Safari so it seems like this is a browser-related issue.
I've noticed that the highcharts demoes do not have this problem, so it must be something I'm doing in my implementation but I'm having a very difficult time figuring it out. What is it that Firefox does differently that could cause this sort of problem with highcharts?
Point of interest: if I set the chart's useHtml parameter to true, the legend entries become clickable. This is not a solution however because it breaks a bunch of other stuff.
Thanks!
I had a similar problem, in which points in line graphs were not clickable in Firefox (but they were clickable in Chrome). Turned out that Firefox places the dataLabels on top of the graph points.
Solved it with:
plotOptions: {
series: {
dataLabels: {
zIndex: 2
See also:
http://api.highcharts.com/highcharts#plotOptions.series.dataLabels
I solved this problem, which happened for me in Firefox, Chrome, and Safari, but not in IE9.
I found out the problem is CSS related. My page has 2 "boxes"; left and right. My Vaadin pie chart is sitting on the right box. On the left box I have a html <H1> tag that has width overflow to the right box (width: 900px) which covers part of the pie chart. As a result some rectangular area is not clickable. This can easily be fixed by using the Firefox Firebug tool to inspect the CSS. I hope this saves you the hours I spent to install the latest vaadin chart library; debug the codes, etc.

Bootstrap tooltips too large and square

I am trying to implement the bootstrap tooltips, instead of the small fitted black area like in the examples, I am experiencing a large outer rectangular box. Just wondering if anyone has encountered this problem?
I am initializing with
$("[rel=tooltip]").tooltip();
My tooltip area is
<a id="button" style="float: left; margin-left:12px; margin-right:2px" rel="tooltip" title="first tooltip" href="#"></a>
I was being terribly dumb, there was another file in the project that was overriding some of the bootstrap css files. I found this by using google chrome devloper tools>going to scripts, pausing while the hover box was up and then going back to elements, inspecting the hover and viewing which css files are being used.

Resources