Page 1 of 1

label on x axis using DPLOTLIB.DLL

Posted: Wed Jan 03, 2007 9:42 am
by Mad2Max
Hi,
I'd like to make a graph using dPlot Jr just like it happens using example.xls -> BarChart -> BarChart(label, Y1, Y2) and so getting label on X axis ... is it possible using dplotlib.dll? If yes, can you give me a hint?
Is it possible to have label on X axis using not barchart but "standard" xyplot?

Thanks and regards,
Max

Posted: Wed Jan 03, 2007 10:27 am
by DPlotAdmin
I'd like to make a graph using dPlot Jr just like it happens using example.xls -> BarChart -> BarChart(label, Y1, Y2) and so getting label on X axis ... is it possible using dplotlib.dll?
Yes. (FYI the Add-In uses DPLOTLIB.DLL, so anything it does you can also do programmatically.)
If yes, can you give me a hint?
The best hint is to take a look at Sub BarChart() in the Add-In to see what it does. In Excel select Tools>Macro>Visual Basic Editor. In the Project pane click on "dplotlib (DPLOTLIB.XLA)". You'll be prompted for a password; use "dplot" without the quotes. Under "dplotlib (DPLOTLIB.XLA)" click the plus sign next to Modules, then double-click "DPlotData" and search for "Sub BarChart".

The numbers on the X axis are turned off with

Code: Select all

cmds = cmds & "[NumberFormat(0," & Str$(NF_NONE) & ")]"
Labels are added a bit below that line with an XYLabel command:

Code: Select all

cmds = cmds & "[XYLabel(" & Str$(k + 0.5) & ",0,0," & Chr$(34) & label & Chr$(34) & ")]"
Is it possible to have label on X axis using not barchart but "standard" xyplot?
Yes, there's no difference. Just use a different ScaleCode. In the BarChart routine you'll notice that the labels are offset from the X value associated with the bar (Str$(k + 0.5)) so that the labels are centered on the bar rather than the left side of the bar. For other scale types you'll probably not want that offset.

Posted: Fri Jan 05, 2007 11:01 am
by Mad2Max
Thanks a lot!