Labels cut off - horizontal bar graph

32 views
Skip to first unread message

Nishant rayan

unread,
Jul 4, 2010, 3:04:29 PM7/4/10
to plo...@googlegroups.com

Hi,
I am using plotkit 0.9 along with mochkit 1.4.2  to show some stats and stumbled upon the issue discussed here,
http://groups.google.com/group/plotkit/browse_frm/thread/1a46afbe6533af58
As you can see from attachment the labels are cut . If i individually increase the width (using firebug) the label just overlaps with the bar.

Please let me know if there is anyway to increase label width without skewing the horizontal axis data..


<script....
function drawGraph() {
            var xTicks = [
                {label: "SampleStatistics1", v: 0},
                {label: "SampleStatistics2", v: 1},
                {label: "SampleStatistics3", v: 2}
            ];

            var layout = new PlotKit.Layout("bar", {"xTicks":xTicks,"barOrientation":"horizontal",w:1,h:1});
            layout.addDataset("sqrt", [
                ["0", 20],
                ["1", 10],
                ["2", 50],
            ]);
            layout.evaluate();
            var canvas = MochiKit.DOM.getElement("graph");
            var opts = {
                "padding": {left: 50, right: 50, top: 20, bottom: 20},
                "axisLabelFontSize":12
            };

            var plotter = new PlotKit.SweetCanvasRenderer(canvas, layout, opts);
            plotter.render();


        }

        MochiKit.DOM.addLoadEvent(drawGraph);
</script>




<div style="display:block;" id="bargraph">
    <canvas id="graph" height="300" width="300"></canvas>
</div>
PlotKit_Issue.JPG

Martin Kleppmann

unread,
Jul 10, 2010, 6:29:25 PM7/10/10
to plotkit
Hi Nishant,

I think the axisLabelWidth option to Renderer should do what you want.
http://ept.github.com/plotkit/doc/PlotKit.Renderer.html

Best,
Martin

On Jul 4, 12:04 pm, Nishant rayan <nishantra...@gmail.com> wrote:
> Hi,
> I am using plotkit 0.9 along with mochkit 1.4.2  to show some stats and
> stumbled upon the issue discussed here,http://groups.google.com/group/plotkit/browse_frm/thread/1a46afbe6533...
>  PlotKit_Issue.JPG
> 29KViewDownload
Reply all
Reply to author
Forward
0 new messages