Page 1 of 2

Problem with DrawBarGraph

Posted: Thu Jul 11, 2013 5:23 pm
by chrisjx2002
Hello,

When I want to draw a bar graph, the labels are not in front of the bars (look at the attached file : there is a little shift for each month). I have made a small example of that problem using the sample in GRAPH.03. If using the line or point there is no problem. The bug seems to be in h_graph.prg but I don't know how to correct it.

There is another limit in this program : it is impossible to draw a graph with more than 16 values. I have to change it in the h_graph.prg program and to make a rebuild. The values that have to be changed are in the FOR NEXT using ni.

Any help would be very appreciated

Re: Problem with DrawBarGraph

Posted: Tue Jul 16, 2013 3:32 pm
by chrisjx2002
RE UP

Nobody uses this function or there is perhaps another possibility to draw graph with HMG?

Re: Problem with DrawBarGraph

Posted: Tue Jul 16, 2013 4:04 pm
by Rathinagiri
I will check and revert back.

Re: Problem with DrawBarGraph

Posted: Tue Jul 16, 2013 4:53 pm
by chrisjx2002
Thanks a lot!

Re: Problem with DrawBarGraph

Posted: Wed Sep 04, 2013 4:59 pm
by chrisjx2002
Hello,

I have made some changes in the h_graph.prg file in order to have the labels in front of the bars.

You will find attached the new version. I have also supress three variables that seems to do nothing : nSep, nResH and nResV.

I also change the limits of the graph in order to have the possibility to have 31 bars : for a graph on a month for example.

I test it with the 3.0.46 version. It seems to work correctly.

You can add it in a next release of HMG.

Regards

Re: Problem with DrawBarGraph

Posted: Wed Sep 04, 2013 7:46 pm
by Pablo César
chrisjx2002 wrote:I have made some changes in the h_graph.prg file in order to have the labels in front of the bars.
..//..
I also change the limits of the graph in order to have the possibility to have 31 bars : for a graph on a month for example.
Good. Can you post any example just to see the differances ?
I have also supress three variables that seems to do nothing : nSep, nResH and nResV.
What I noted that nSep, nResH and nResV is used in several places. I think it is used as factorial value. Sorry, but I do not think is good idea to be removed.

Re: Problem with DrawBarGraph

Posted: Thu Sep 05, 2013 6:09 am
by chrisjx2002
Hello,

To test it you can use the samples provided with HMG. You will notice that now the labels are in the right places. You can see that on the screenshots that have joined to this previous message : on the first there is a shift of the labels.

For the parameters that i have suppressed do as you want but they are fixed values that are not changed in the programm... Perhaps they were created for a future option never developed.

Regards

Problem with DrawBarGraph

Posted: Thu Sep 05, 2013 2:44 pm
by Pablo César
chrisjx2002 wrote:To test it you can use the samples provided with HMG.
I have not the same example to test it.
chrisjx2002 wrote:I have made a small example of that problem using the sample in GRAPH.03.
I have compiled this same teste and the result seems ok for me:
Screen65.PNG
Screen65.PNG (23.78 KiB) Viewed 4605 times
I have compiled this example without your modifications, ie, with original HMG lib.
You can see that on the screenshots that have joined to this previous message : on the first there is a shift of the labels.
It is for this reason I asked you to post this example to be compared.
For the parameters that i have suppressed do as you want but they are fixed values that are not changed in the programm... Perhaps they were created for a future option never developed.
You are right: at moment it has not any function because this local variables are default value with 1 for (nResH and nResV) and 0 for nSep. But if you see this nSep could be assignable because is an argument of function, look at this:

Procedure GraphShow(parent,nTop,nLeft,nBottom,nRight,nHeight,nWidth,aData,cTitle,aYVals,nBarD,nWideB,nSep,nXRanges,;
l3D,lGrid,lxGrid,lyGrid,lxVal,lyVal,lLegends,aSeries,aColors,nType,lViewVal,cPicture , nLegendWindth , lNoborder )

But at i_graph.ch nSep is with value Nil then inside the procedure will be assigned a default value with 0.

Any way, my suggestion it is to let like this, probably in the future, could make new parameters and can be utilized this variables. For now, I do not think this is problem for untidy strings in the graphic. Doesn't it ? And better not be cutted off these variables in order to let for the future implements.

Thanks for your explanations but I would to know where exactly you have modified. I shall see later both sources to compare...

Re: Problem with DrawBarGraph

Posted: Fri Sep 06, 2013 3:51 pm
by chrisjx2002
Hello,

When you look at the graph, it is not good. Look at the green bar. On the first month the bar is in front of the label : Jan. For the label Mar it is the orange bar and for May it is the purple one.

If you change the h_graph.prg by the one I have modified you will have for this example another graph where the green bar is always in front of the label : no shift.

The change is at line 526 : nPos += nWide+nSep
is replaced by
nPos += ( nWideB - nWide )/ Len(aSeries) - 10 * (Len(aSeries) - 1) / Len(aSeries)

I have made a few tests with this correction and it seems to be OK. What is strange is that it is OK for the other kinds of graph.

Problem with DrawBarGraph

Posted: Fri Sep 06, 2013 5:34 pm
by Pablo César
Chrisjx2002, thank you for your explanations. :)

But sorry, in my humble opinion, this graphic should be shown like this:
Screen65a.PNG
Screen65a.PNG (74.19 KiB) Viewed 4446 times
Please note, this graphic I re-edited by "Paint Brush". Also see that quadrants are out of range in the original picture. Should be shown 5 columns not 6.

For me, this rotine there is more than this problem of columns description (in this case months).