|
Round Meter chart settings |
Posted by Daniel on Dec-04-2015 19:28 |
|
Hi Peter,
I try to adjust the Round Meter chart used by you in the vbdemo sample. Unfortunately
all your examples from the section "Meters,Dials,Guages" are a bit uniform and poor in
some details that I am looking for. For example I didn't find how to set the font scale in
terms of name, size or color. As you can see in the image, if we minimize the chart size
from 200x200 pixels to 130x130 (my case) the numbers of scale remain unchanged and
bigger in relation with other details within chart. So as long as these round meter charts
cannot be adjusted automaticaly inside the chart frame (let's say using a dedicated
method) would be useful to know how to set them optimal in terms of proportionality.
The code I have written so far is as follows:
Dim cd As ChartDirector.API
Set cd = New ChartDirector.API
Const value As Double = 45.17
Dim m As AngularMeter
Set m = cd.AngularMeter(130, 130, cd.silverColor(), &H0, -2)
Call m.setRoundedFrame
Call m.setMeter(65, 65, 50, -135, 135)
Call m.setScale(0, 100, 10, 5, 1)
Call m.setLineWidth(0, 2, 1)
Call m.addRing(0, 55, cd.metalColor(&H9999DD))
Call m.addRing(53, 55, &H6666FF) 'Add a blue ring (6666FF)
Call m.addZone(0, 60, &H99FF99)
Call m.addZone(60, 80, &HFFFF00)
Call m.addZone(80, 100, &HFF3333)
Call m.addPointer(value, &H40333399)
Set ChartViewer1.Picture = m.makePicture()
Also I do not understand why the frame corners (which are rounded) do not get the
background color remaining on a solid white ? Thanks in advance.
|
Re: Round Meter chart settings |
Posted by Peter Kwan on Dec-05-2015 03:10 |
|
Hi Daniel,
In previous versions of ChartDirector, all of the meter and gauges sample code use hard
coded dimensions to make the code as simple as possible. It is because the main purpose
of the sample code is to be used as tutorials for the API, and so we think it should as
simple as possible.
In practice, to create a chart with variable size, instead of using a hard coded size (like
200), you can use a variable as the size. The various coordinates and sizes, such as the
meter center position, meter radius, font size, tick lengths and thickness, etc, can be
programmable as a fraction of the size parameter.
In ChartDirector 6.0, we have added quite a number of meters and gauges examples,
some of which demonstrates variable size. For example:
http://www.advsofteng.com/doc/cdcom.htm#neonroundmeter.htm
In the above sample code, you can see something like:
size = 300
' The radius of the meter scale
scaleRadius = Int(outerRadius * 92 / 100)
' Major tick length
tickLength = Int(scaleRadius * 10 / 100)
' Major tick width
tickWidth = Int(scaleRadius * 1 / 100 + 1)
' Label font size
fontSize = Int(scaleRadius * 13 / 100)
.....
Call m.setLabelStyle("ariali.ttf", fontSize)
Call m.setTickLength(-tickLength, -Int(tickLength * 80 / 100), -Int(tickLength * 60 /
100))
Call m.setLineWidth(0, tickWidth, Int((tickWidth + 1) / 2), Int((tickWidth + 1) / 2))
So the object sizes are all relative to the main size, which is 300 in the above code.
Hope this can help.
Regards
Peter Kwan |
Re: Round Meter chart settings |
Posted by Daniel on Dec-08-2015 17:02 |
|
Hello Peter,
Thank you for reply. Your new ChardtDirector version has some new features but all I
needed in my code was the line "Call m.setLabelStyle("ariali.ttf", fontSize)". It allowed me
to set properly the size of the scale font. Unfortunately with new CD version a registering
issue occured regarding aspapi.dll library. Did you change something inside ? Until 6
version I hadn't any problem with my setup. Maybe this file has some incompatibilities
with Windows 7. As details, for installing I use Setup Factory 8 and the files structure is as
follows: ChartViewer.ocx is installed in SysWOW64 and aspapi.dll, chartdir60.dll and
comchartdir.dll in the same folder somewhere in the C directory. Thank you in advance.
|
Re: Round Meter chart settings |
Posted by Peter Kwan on Dec-09-2015 01:41 |
|
Hi Daniel,
There is no significant difference in the aspapi.dll except that it is now linked to
"chartdir60.dll" (instead of "chartdir51.dll"), and that it is compiled using VS2005 (instead
of VS6).
For your case, is it the first time you install ChartDirector in that particular Windows 7
machine, or have you ever installed an older version using the same method (Setup
Factory 8) to confirm that an older version works?
In any case, to diagnose the problem, please try to install manually:
(a) Verify that the directory contains "aspapi.dll", "chartdir60.dll" and "comchartdir.dll".
(b) Verify that the "aspapi.dll" file size is 126976 bytes. This is to confirm that the
aspapi.dll is the one for ChartDirector 6.
(c) Verify that they are not blocked, and unblock them manually if necessary. On
Windows, many files types copied or downloaded from untrusted sources (such as
download from the Internet or from a network) may be marked as blocked. See:
http://www.advsofteng.com/unblock_zip.html
(d) Open a command point using "Run As Administrator", change to the directory that
contains the files, and enter:
regsvr32 aspapi.dll
Please kindly let me know if the "aspapi.dll" can be registered manually. If it can be
installed manually, but "Setup Factory 8" cannot install it, it means the installation
method of "Setup Factory 8" is not equivalent to the manual installation. Some of the
issues I can think of are:
- The registration occurs before the files are copied. I have seen an installer that copy
the "aspapi.dll" to the directory, then register it immediately without waiting for the other
files to be copied first, which can produce registration errors.
- The "Setup Factory 8" is trying to load "aspapi.dll" as a 64-bit DLL, but it is a 32-bit
DLL. From my understanding, the Microsoft "regsvr32" should automatically detect if it is
a 32-bit and 64-bit DLL and register it appropriately.
- Some security feature in the system has blocked the installation. Try using "Run As
Administrator".
Regards
Peter Kwan |
Re: Round Meter chart settings |
Posted by Daniel on Dec-09-2015 17:22 |
|
Hi Peter,
Meanwhile I solved the issue. It is no problem neither with my setup builder nor
how/where the aspapi library was compiled, fortunately. Also it was nothing related to
UAC, antivirus protection or other OS app that could block the untrusted sources. The
aspapi.dll is "clean" and it can be registered either manually or automatically. However it
has a weakness. It is dependent on chartdir60.dll as a child by a parent. What I want to
say ? The ORDER in which these are registered is crucial. It is not sufficient to have in the
same folder "aspapi.dll", "chartdir60.dll" and "comchartdir.dll" but is mandatory to register
them in this order: 1."chartdir60.dll" 2."aspapi.dll" 3."comchartdir.dll". In my case, I found
that my issue occured when Setup Builder tries to register these libraries in a random
order, first file being aspapi.dll ... I think you missed this detail in the Installing chapter
from CD Help. I don't know how complex is this small library (aspapi.dll) but considering
this internal dependency I just wonder why was not technically possible to include it in
chartdir60.dll as long as both of them are registerable. I use chartdirector library for many
years and for desktop applications exclusively and I feel each time a small inconvenience
when instead of one ocx I have to use 4 files : ChartViewer.ocx + 3 dll's above. Maybe
you could find a smaller configuration in the future. Many thanks for your support. |
Re: Round Meter chart settings |
Posted by Peter Kwan on Dec-10-2015 00:42 |
|
Hi Daniel,
Our installer (chartdir_com.exe) uses the following methods:
(a) Extract all files.
(b) Register the DLLs.
It work no matter what is the dependency, because it extract all files first before
registration. I am thinking, may be your installer also has this feature - extract all files first,
then register. It should be a more robust way to install files and can even support mutually
dependent DLLs.
Regards
Peter Kwan |
|