Jump to content
Software FX Community

Masking out Chart PointLabels


User (Legacy)

Recommended Posts

Trying to mask out PointLabels when the point does not reach some target

value (say 10%) to prevent messy overlapping labels. I've tried to set

Chart1.Point(n,m).PointLabels = False

Chart1.Point(n,m+1).PointLabels = True

but this doesn't work as both are displayed

Is there any other hidden property that should be set in order to disable a

particular point in a serie?

Zarko

Link to comment
Share on other sites

This code should work perfectly assuming n and m are correct.

I just pasted it into a brand new chart and works fine. Can you please give

us a little more info about the context in which this is being used. A

sample program that reproduces the problem would be ideal.

FP

Software FX Support

"Zarko Ursic" <zursic@probert.com> wrote in message

news:JtzyBpR2DHA.3808@WEBSERVER1...

> Trying to mask out PointLabels when the point does not reach some target

> value (say 10%) to prevent messy overlapping labels. I've tried to set

>

> Chart1.Point(n,m).PointLabels = False

> Chart1.Point(n,m+1).PointLabels = True

>

> but this doesn't work as both are displayed

> Is there any other hidden property that should be set in order to disable

a

> particular point in a serie?

>

>

> Zarko

>

>

Link to comment
Share on other sites

Ok, find below the relevant part of the code used (not significant details

omitted):

....

dr =

SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("connAtum"),

sp,

sID.Value)

Chart1.PointLabels = pointLabel_flag

maskString = "%v " + Chr(10) + "(" + "%P " + "%% )"

maskString = "%P " + "%%"

Chart1.PointLabelMask = maskString

Chart1.AxisX.Step = 1

If dr.HasRows Then

j = 0

Do While dr.Read()

Chart1.AxisX.Label(j) = dr.GetString(0)

For i = 1 To dr.FieldCount - 1

If dr.GetInt32(i) < 16 Then

Chart1.Point(j, i - 1).PointLabels = False

Else

Chart1.Point(j, i - 1).PointLabels = True

End If

Next

j = j + 1

Loop

End If

dr =

SqlHelper.ExecuteReader(ConfigurationSettings.AppSettings("connAtum"),

sp,

sID.Value)

Chart1.DataSource = dr

Chart1.DataBind()

.....

Find attached the exported files with produced results for your convenience.

Should I use a dataset instead (as a better practice) in order to keep data

locally?

Zarko

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

news:#Iyjto72DHA.592@webserver1.softwarefx.com...

> This code should work perfectly assuming n and m are correct.

>

> I just pasted it into a brand new chart and works fine. Can you please

give

> us a little more info about the context in which this is being used. A

> sample program that reproduces the problem would be ideal.

>

> FP

> Software FX Support

>

>

> "Zarko Ursic" <zursic@probert.com> wrote in message

> news:JtzyBpR2DHA.3808@WEBSERVER1...

> > Trying to mask out PointLabels when the point does not reach some target

> > value (say 10%) to prevent messy overlapping labels. I've tried to set

> >

> > Chart1.Point(n,m).PointLabels = False

> > Chart1.Point(n,m+1).PointLabels = True

> >

> > but this doesn't work as both are displayed

> > Is there any other hidden property that should be set in order to

disable

> a

> > particular point in a serie?

> >

> >

> > Zarko

> >

> >

>

>

Link to comment
Share on other sites

The problem is, in your code you are INVERTING the Point/Series index.

If dr.HasRows Then

j = 0

Do While dr.Read()

Chart1.AxisX.Label(j) = dr.GetString(0)

For i = 1 To dr.FieldCount - 1

If dr.GetInt32(i) < 16 Then

Chart1.Point(j, i - 1).PointLabels = False

Else

Chart1.Point(j, i - 1).PointLabels = True

End If

Next

j = j + 1

Loop

Chart1.Point(j, i - 1).PointLabels

Refers to SERIES j and point i-1, this contradicts the setting:

Chart1.AxisX.Label(j) = dr.GetString(0)

In which j refers to the POINT index.

I think (I'm not sure because I'm not sure what you want to plot) you need

to do:

If dr.GetInt32(i) < 16 Then

Chart1.Point(i - 1,j).PointLabels = False

Else

Chart1.Point(i - 1,j).PointLabels = True

End If

Another observation:

For i = 1 To dr.FieldCount - 1

Looks incorrect. Shouldn't it be:

For i = 1 To dr.FieldCount

Or are pourposedly ignoring the last field ?

--

FP

Software FX, Inc.

mygraph.zip

Link to comment
Share on other sites

OK, that is

Thank you to having pointed this out

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

news:RlWE9sq3DHA.496@webserver1.softwarefx.com...

> The problem is, in your code you are INVERTING the Point/Series index.

>

> If dr.HasRows Then

> j = 0

> Do While dr.Read()

> Chart1.AxisX.Label(j) = dr.GetString(0)

> For i = 1 To dr.FieldCount - 1

> If dr.GetInt32(i) < 16 Then

> Chart1.Point(j, i - 1).PointLabels = False

> Else

> Chart1.Point(j, i - 1).PointLabels = True

> End If

> Next

> j = j + 1

> Loop

>

> Chart1.Point(j, i - 1).PointLabels

>

> Refers to SERIES j and point i-1, this contradicts the setting:

>

> Chart1.AxisX.Label(j) = dr.GetString(0)

>

> In which j refers to the POINT index.

>

> I think (I'm not sure because I'm not sure what you want to plot) you

need

> to do:

>

> If dr.GetInt32(i) < 16 Then

> Chart1.Point(i - 1,j).PointLabels = False

> Else

> Chart1.Point(i - 1,j).PointLabels = True

> End If

>

> Another observation:

>

> For i = 1 To dr.FieldCount - 1

>

> Looks incorrect. Shouldn't it be:

>

> For i = 1 To dr.FieldCount

>

> Or are pourposedly ignoring the last field ?

>

> --

> FP

> Software FX, Inc.

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...