label on x axis using DPLOTLIB.DLL

Q&A for C, C++, and/or C# developers using DPlot

Moderator: DPlotAdmin

Post Reply
Mad2Max
Posts: 16
Joined: Wed Jan 03, 2007 9:34 am

label on x axis using DPLOTLIB.DLL

Post 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
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post 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.
Visualize Your Data
support@dplot.com
Mad2Max
Posts: 16
Joined: Wed Jan 03, 2007 9:34 am

Post by Mad2Max »

Thanks a lot!
Post Reply