简体   繁体   English

我怎样才能让我的Jchartfx面积图显示在我的gridview下?

[英]How can i get my Jchartfx area graph to show up underneath my gridview?

My page renders like this this , The graph keeps showing up at the top left corner, even though the div its supposed to show up in is in the correct position(underneath the grid view). 我的页面呈现这样这样 ,图形一直显示在左上角时,即使在div它应该显示在处于正确位置(网格视图下方)。

var chart1;
function makeGraph(mpy)
{
    if (mpy == undefined) mpy = 12.00;
    chart1 = new cfx.Chart();
    chart1.getData().setSeries(1);
    chart1.getAxisY().setMin(baseRoi-50);
    chart1.getAxisY().setMax(finalroi+50);
    var series1 = chart1.getSeries().getItem(0);
    series1.setGallery(cfx.Gallery.Area);
    var data=genGraphData(mpy);       
    chart1.setDataSource(data);
    var divHolder = document.getElementById('ChartDiv');
    chart1.create(divHolder);
}

my html looks like 我的HTML看起来像

<div id="pnlROIDetails">
<label id="lblRoiResult"> </label>
<div id="pnlROIChart">
    <label id="lblHelp">Help</label>
    <div id="jqxgrid" style="font-size: 13px; font-family: Verdana; float: left;"> </div>
</div>
<div id="pnlROIGraph" style="clear:both">
    <div id="ChartDiv" style="width:700px;height:500px; float:left;">
    </div>
</div>

I am assuming all of this can be fixed with css, I am just not sure how. 我假设所有这些都可以用CSS修复,但我不确定如何。 Any help is greatly appreciated, thanks! 非常感谢任何帮助,谢谢!

I would suggest using relative and absolute positioning to force your grid to stay within it's wrapper. 我建议使用相对和绝对定位来迫使网格保持在其包装内。

Based on the picture you gave though, it's hard for me to actually tell which div is the grid. 但是根据您给的图片,我很难真正分辨出哪个div是网格。 I would guess #ChartDiv is the same as #chartWrapper (in my example below) and the #chart might be the next one under, but I'd need you to confirm that by being able to highlight the actual grid with the dev tools like you did for the image. 我猜想#ChartDiv#chartWrapper相同(在下面的示例中),并且#chart可能是下一个,但我需要您通过使用诸如以下的dev工具突出显示实际的网格来确认这一点。您为图像做的。

So, the solution would go as follows: #chartWrapper { position:relative; } 因此,解决方案如下: #chartWrapper { position:relative; } #chartWrapper { position:relative; } #chart { position:absolute; top:0px; left:0px; } #chartWrapper { position:relative; } #chart { position:absolute; top:0px; left:0px; } #chart { position:absolute; top:0px; left:0px; }

An absolutely positioned item calculates its' point of reference as the closest parent with the position:relative style. 绝对定位的项目将其参考点计算为与position:relative样式最接近的父项。 So for the above example, the #chart would be 0px from the top of #chartWrapper and 0px from the left of it. 因此,对于上面的示例, #chart#chartWrapper的顶部开始为0px,从其左侧为0px。

Hope that helps! 希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM