square / cubism

Cubism.js: A JavaScript library for time series visualization.

Home Page:https://square.github.com/cubism/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rule offset in 1.2.0

rhuss opened this issue · comments

While for previous version the rule was aligned with the mouse pointer, with 1.2.0 there is now an offset to the pointer (in my use case).

Screeenshot

Prior to 1.2.0, the rule was position: fixed; in c4d23ab, it changed to position: absolute. This means that it depends on the container element (typically the body) being position: relative. Is that true in your case? See the Cubism website for an example. Otherwise, please provide an example to reproduce this issue.

I'm using 960 grid system (http://960.gs) with a fixed layout, centered with margin: auto. I prepared a demo page here --> https://gist.github.com/2993922

It turns out, that

<div style="margin-left: auto; margin-right: auto; width: 960px"> 
   <div id="chart">....</div>
</div>

triggers this issue.

I don't think this is an uncommon use case. Because you've closed this issue, I guess you already have a solution or recommendation for this use case ?

I forgot: this problem occurs for me in Chrome 19.0.1084.56 and Firefox 14.0

Right, you'll need to add "position: relative;" to the containing div when you're using margins.

Thanks for clarifying this, understand css positioning now better ;-)

BTW, the ruler is interrupted between sections since I have a structure like

<div>
   <div style="position: relative; margin: 10px">
      <div id="chart1"/>
   </div>
   <div style="position: relative; margin: 10px">
      <div id="chart2"/>
   </div>

The solution

<div style="position: relative">
   <div style="margin: 10px">
       <div id="chart1"/>
   </div>
   <div style="margin: 10px">
        <div id="chart2"/>
   </div>
</div>

doesn't work because of the margin in the inner containers (which I can't avoid). But that's ok for me.