Jump to content
Software FX Community

show unwanted line on graph


Recommended Posts

Hi,

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:VD4siA3jDHA.3296@WEBSERVER1...

> I already answered this question before. I don't understand why the

> duplicate post. Here is my old answer:

Chia: In fact I try one of your method that posted previously but it doesn't

work and that is why I re-posted it again

> > The only way to achieve this is that to SKIP the null values instead of

> > setting it to the chart and use the date field as labels instead of

> > X-Values.

Chia: How to SKIP the NULL value. For my case, In fact I already skip the

NULL value and if I didn't put back the NULL value at the end of the graph,

I will get Broken line graph and that is why I set all the NULL value as

HIDDEN.

> > If you use the dates as X-Values, the distance between Dec and Feb WILL

BE

> > greater than the distance between Feb and Mar. If you use labels

instead,

> > the intrinsic value of the date is lost so the position is not affected

by

> > it.

Chia: Can you show some example for this? I not really can get your idea.

Thx

> Is there something here that you don't understand ?

>

> --

> FP

> Software FX, Inc.

>

>

Link to post
Share on other sites

Hi all,

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:DvxGV8AlDHA.3624@WEBSERVER1...

> Please post a follow up in the appropriate thread.

Chia: Seem likes no reply from my previous question and that is why I post

another new thread.

>

> What didn't work ? What did you do ?

Chia: Please refer to my previous email and you will know why it didn't work

for my case. I still get a straight line. My question here is how to

eliminate the straight line from dec 2002 to feb 2003?

> By posting in a new thread all you are doing is starting from zero again

and

> delaying the whole process.

Chia: Very very sorry to do it.

> --

> FP

> Software FX, Inc.

>

>

Link to post
Share on other sites

By "skipping" the NULL values I meant going through the data and feeding

into the chart only those points that are not null.

In other words, you will end up with a chart containing exactly the number

of points that you want to see.

Chart FX will no skip this data automatically, you will need to go through

the recorset yourself and set the data point-by-point. Something like this:

ChartFX1.OpenDataEx COD_VALUES, 1, COD_UNKNOWN

RS.MoveFirst

i = 0;

While Not RS.EOF

if (RS("ValueField") is not null) Then

ChartFX1.ValueEx(0,i) = RS("ValueField")

ChartFX1.Legend(i) = RS("LabelField")

i = i + 1

End If

RS.MoveNext

Wend

ChartFX1.CloseData COD_VALUES

--

FP

Software FX, Inc.

Link to post
Share on other sites

Please refer to my attachment (graph.zip) and run the

continuous_graph.vbp project file

and

non_continuous_graph.vbp project file.

and you will know what problem i am facing off right now.

For continuous_graph.vbp project, it included data from 1 Dec 2002 to 28 Feb

2003 with weekend as null value

and for non_continuous_graph.vbp project, it included data from 1 Dec 2002

to 31 Dec 2002 and from 1 Feb 2003 to 28 Feb 2003 with weekend as null

value. or in simple term, it excluded Jan 2003 data.

Hope my sample program will clear the air and hope to get your reply soon.

Regards,

Chia

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:ZXOoPTxlDHA.1152@WEBSERVER1...

> By "skipping" the NULL values I meant going through the data and feeding

> into the chart only those points that are not null.

>

> In other words, you will end up with a chart containing exactly the number

> of points that you want to see.

>

> Chart FX will no skip this data automatically, you will need to go through

> the recorset yourself and set the data point-by-point. Something like

this:

>

> ChartFX1.OpenDataEx COD_VALUES, 1, COD_UNKNOWN

> RS.MoveFirst

> i = 0;

> While Not RS.EOF

> if (RS("ValueField") is not null) Then

> ChartFX1.ValueEx(0,i) = RS("ValueField")

> ChartFX1.Legend(i) = RS("LabelField")

> i = i + 1

> End If

> RS.MoveNext

> Wend

> ChartFX1.CloseData COD_VALUES

>

> --

> FP

> Software FX, Inc.

>

>

Link to post
Share on other sites

You are still setting the dates as x-values. In BOTH cases.

Again, here is the code I suggested:

ChartFX1.OpenDataEx COD_VALUES, 1, COD_UNKNOWN

RS.MoveFirst

i = 0;

While Not RS.EOF

if (RS("ValueField") is not null) Then

ChartFX1.ValueEx(0,i) = RS("ValueField")

ChartFX1.Legend(i) = RS("LabelField")

i = i + 1

End If

RS.MoveNext

Wend

ChartFX1.CloseData COD_VALUES

As you can see, THERE IS NO X-Values. Dates are being passed as LABELS.

If you keep passing dates as X-Values, they will have an intrinsic value and

the distance between 25-Dec and 20-Jan WILL be greater than the distance

from 13-Dec to 25-Dec. So if you want equally spaced points regardless of

the date DO NOT USE X-VALUES.

I don't understand why the two loops in your code.

Here is the modified code:

With cfxChart

.OpenDataEx COD_VALUES, rsDataPrm.Fields.Count - 1, COD_UNKNOWN

For i = 1 To rsDataPrm.Fields.Count - 1 'exclude Transdate

rsDataPrm.Filter = rsDataPrm.Fields(i).Name & " <> NULL"

'populate non-null value first

For k = 0 To rsDataPrm.RecordCount - 1

If Not IsNull(rsDataPrm(i).Value) Then

.Series(i - 1).Yvalue(j) = rsDataPrm(i).Value

.Legend(j) = Format(rsDataPrm("TransDate").Value,

"dMMMyy")

j = j + 1

End If

rsDataPrm.MoveNext

Next

Next

.CloseData COD_VALUES

End With

I hope this makes it clear.

--

FP

Software FX, Inc.

Link to post
Share on other sites

Hi,

Your example was really great and solved my problem. But I have some

problem here. My previous example just have 1 series only which was Daily

Data.

The reason I have 2 loops is because I need to populate more than 1 series

and my latest attachment will show you the problem that I am facing right

now.

I have 3 series, first one is Daily data, second one is Weekly data and

last one is Monthly data. I managed to generate a dummy recordset but when

come to populate the graph, it give unwanted graph. Please unzip the

attachment and run and you will see the problem.

If I use my old method to populate the data, it is fine except for Jan

2003 data's problem.

Hope to get your reply soon.

Again, thanks a lot for your prompt reply.

Regards,

Chia

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:w8JpBzNmDHA.536@WEBSERVER1...

> You are still setting the dates as x-values. In BOTH cases.

>

> Again, here is the code I suggested:

>

> ChartFX1.OpenDataEx COD_VALUES, 1, COD_UNKNOWN

> RS.MoveFirst

> i = 0;

> While Not RS.EOF

> if (RS("ValueField") is not null) Then

> ChartFX1.ValueEx(0,i) = RS("ValueField")

> ChartFX1.Legend(i) = RS("LabelField")

> i = i + 1

> End If

> RS.MoveNext

> Wend

> ChartFX1.CloseData COD_VALUES

>

> As you can see, THERE IS NO X-Values. Dates are being passed as LABELS.

>

> If you keep passing dates as X-Values, they will have an intrinsic value

and

> the distance between 25-Dec and 20-Jan WILL be greater than the distance

> from 13-Dec to 25-Dec. So if you want equally spaced points regardless of

> the date DO NOT USE X-VALUES.

>

> I don't understand why the two loops in your code.

>

> Here is the modified code:

>

> With cfxChart

> .OpenDataEx COD_VALUES, rsDataPrm.Fields.Count - 1, COD_UNKNOWN

> For i = 1 To rsDataPrm.Fields.Count - 1 'exclude Transdate

> rsDataPrm.Filter = rsDataPrm.Fields(i).Name & " <> NULL"

> 'populate non-null value first

> For k = 0 To rsDataPrm.RecordCount - 1

> If Not IsNull(rsDataPrm(i).Value) Then

> .Series(i - 1).Yvalue(j) = rsDataPrm(i).Value

> .Legend(j) = Format(rsDataPrm("TransDate").Value,

> "dMMMyy")

> j = j + 1

> End If

> rsDataPrm.MoveNext

> Next

> Next

> .CloseData COD_VALUES

> End With

>

> I hope this makes it clear.

>

> --

> FP

> Software FX, Inc.

>

>

Link to post
Share on other sites

What you want here is sort of contradictory.

On one hand, you want Chart FX to IGNORE the intrinsic value of a date

because you want the distance between 31-Dec and 3-Feb to be the same as the

distance between distance between two consecutive days, which are clearly

different. This is why I suggested to get rid of X-Values altogether.

On the other hand, you want to distinguish between Daily Data, Weekly data

and Monthly data. But the data is not really daily, it has a big hole in

January.

You can not have both. You either have a day being a day and therefore have

the appropriate distance to cover for missing data in January or you don't

in which case dates become meaningless and points are plotted as a

collection one after the other, the only way to synchronize these series

would be to interpolate the points for the Monthly and Weekly chart which

will be very hard to do.

In my opinion the initial chart, with the extra distance in January is the

CORRECT chart. It looks like what you want is an arbitrary scale that sees

Jan different than the rest of the months and this is not supported by Chart

FX or by any Charting Software I know.

Bottom line is this are the ONLY two options you have:

1) Stay with the X/Y chart and the consistent distance between days.

2) Interpolate your Weekly and Monthly data to match your "daily" data. This

will be, of course completely arbitrary. You have to define where to put the

monthly data for a specific month, to which point of the "daily" data will

this point correspond to ?

--

FP

Software FX, Inc.

Link to post
Share on other sites

Hi,

Thanks very much for your prompt reply. However may I know how to go for

options 2?

> 2) Interpolate your Weekly and Monthly data to match your "daily" data.

This

> will be, of course completely arbitrary. You have to define where to put

the

> monthly data for a specific month, to which point of the "daily" data will

> this point correspond to ?

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:jpIxa1JnDHA.1264@WEBSERVER1...

> What you want here is sort of contradictory.

>

> On one hand, you want Chart FX to IGNORE the intrinsic value of a date

> because you want the distance between 31-Dec and 3-Feb to be the same as

the

> distance between distance between two consecutive days, which are clearly

> different. This is why I suggested to get rid of X-Values altogether.

>

> On the other hand, you want to distinguish between Daily Data, Weekly data

> and Monthly data. But the data is not really daily, it has a big hole in

> January.

>

> You can not have both. You either have a day being a day and therefore

have

> the appropriate distance to cover for missing data in January or you don't

> in which case dates become meaningless and points are plotted as a

> collection one after the other, the only way to synchronize these series

> would be to interpolate the points for the Monthly and Weekly chart which

> will be very hard to do.

>

> In my opinion the initial chart, with the extra distance in January is the

> CORRECT chart. It looks like what you want is an arbitrary scale that sees

> Jan different than the rest of the months and this is not supported by

Chart

> FX or by any Charting Software I know.

>

> Bottom line is this are the ONLY two options you have:

>

> 1) Stay with the X/Y chart and the consistent distance between days.

>

> 2) Interpolate your Weekly and Monthly data to match your "daily" data.

This

> will be, of course completely arbitrary. You have to define where to put

the

> monthly data for a specific month, to which point of the "daily" data will

> this point correspond to ?

>

> --

> FP

> Software FX, Inc.

>

>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...