PMSI-AlignAlytics / dimple

An object-oriented API for business analytics
Other
2.73k stars 557 forks source link

Reducing margins... #175

Open dss010101 opened 9 years ago

dss010101 commented 9 years ago

I am trying to reduce the top margin/padding on a chart. Currently i can do this using something like the code below:

var svg = dimple.newSvg('#chartContainer', '100%', 400); svg.select("g").attr("transform", "translate(0,-10)")

While the above works, the unintended consequence of this is that the dashed line that are shown when you hover over a series point are still dropped relative to the chart's original positioning..so it looks offset. I am currently on v2.1.2. Wondering if there is a better way of doing this or how i can resolve with v2.1.2.

Here is fiddle showing an example of the issue: http://jsfiddle.net/z6px1kzk/5/

rpaskowitz commented 9 years ago

Docs: https://github.com/PMSI-AlignAlytics/dimple/wiki/dimple.chart#setMargins

Default is 10% on all sides, so you want top to be 10% minus 10px.

myChart.setMargins(10%, 10%,-10px 10%, 10%);

Looks like the method is unchanged since 2.1.2: https://github.com/PMSI-AlignAlytics/dimple/blob/2.1.2/src/objects/chart/methods/setMargins.js

dss010101 commented 8 years ago

I think the second parameter specifies the top. Also, couldn't get this to work with percentage, had to use pixels.