PC Review


Reply
Thread Tools Rate Thread

Datapoint position

 
 
Holger Gerths
Guest
Posts: n/a
 
      19th Apr 2004
Hi,

does anybody know how to find the exact position of a datapoint or a column
in a (stacked) column chart?
The purpose is to place a vertical line (exactly) between to columns.

Thx, Holger.

(E-Mail Removed)



 
Reply With Quote
 
 
 
 
Bernard Liengme
Guest
Posts: n/a
 
      19th Apr 2004
Why not draw the line?
If you check the box the place x-axis labels between columns, the exact
centre is marked for you
Use View|Toolbars to show Drawing toolbar
Click on chart to select it (otherwise the line will not be part of the
chart)
Click the line tool on Drawing toolbar; draw lien. Hold down Shift to help
get vertical line

Best wishes

--
Bernard Liengme
www.stfx.ca/people/bliengme
remove CAPS in e-mail address


"Holger Gerths" <(E-Mail Removed)> wrote in message
news:On2MX%(E-Mail Removed)...
> Hi,
>
> does anybody know how to find the exact position of a datapoint or a

column
> in a (stacked) column chart?
> The purpose is to place a vertical line (exactly) between to columns.
>
> Thx, Holger.
>
> (E-Mail Removed)
>
>
>



 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      19th Apr 2004
Or use a helper series:

http://peltiertech.com/Excel/Charts/AddLine.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Bernard Liengme wrote:

> Why not draw the line?
> If you check the box the place x-axis labels between columns, the exact
> centre is marked for you
> Use View|Toolbars to show Drawing toolbar
> Click on chart to select it (otherwise the line will not be part of the
> chart)
> Click the line tool on Drawing toolbar; draw lien. Hold down Shift to help
> get vertical line
>
> Best wishes
>


 
Reply With Quote
 
Holger Gerths
Guest
Posts: n/a
 
      20th Apr 2004
Argggh! Of course I do speak about drawing the line with VBA!
The Problem is that a datapoint object has no VBA-readable position
properties, only the datalabel has and this is more than unexact!
:-(
Holger.


"Bernard Liengme" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Why not draw the line?
> If you check the box the place x-axis labels between columns, the exact
> centre is marked for you
> Use View|Toolbars to show Drawing toolbar
> Click on chart to select it (otherwise the line will not be part of the
> chart)
> Click the line tool on Drawing toolbar; draw lien. Hold down Shift to help
> get vertical line
>
> Best wishes
>
> --
> Bernard Liengme
> www.stfx.ca/people/bliengme
> remove CAPS in e-mail address
>
>
> "Holger Gerths" <(E-Mail Removed)> wrote in message
> news:On2MX%(E-Mail Removed)...
> > Hi,
> >
> > does anybody know how to find the exact position of a datapoint or a

> column
> > in a (stacked) column chart?
> > The purpose is to place a vertical line (exactly) between to columns.
> >
> > Thx, Holger.
> >
> > (E-Mail Removed)
> >
> >
> >

>
>



 
Reply With Quote
 
Holger Gerths
Guest
Posts: n/a
 
      20th Apr 2004
An answer would be more pleasant!
But I notice that this is a problem which cannot be solved on the fly.
:-(((


"Jon Peltier" <(E-Mail Removed)> schrieb im Newsbeitrag
news:%(E-Mail Removed)...
> Or use a helper series:
>
> http://peltiertech.com/Excel/Charts/AddLine.html
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Peltier Technical Services
> Tutorials and Custom Solutions
> http://PeltierTech.com/
> _______
>
> Bernard Liengme wrote:
>
> > Why not draw the line?
> > If you check the box the place x-axis labels between columns, the exact
> > centre is marked for you
> > Use View|Toolbars to show Drawing toolbar
> > Click on chart to select it (otherwise the line will not be part of the
> > chart)
> > Click the line tool on Drawing toolbar; draw lien. Hold down Shift to

help
> > get vertical line
> >
> > Best wishes
> >

>



 
Reply With Quote
 
Andy Pope
Guest
Posts: n/a
 
      20th Apr 2004
Hi Holer,

If you really must have VBA code to draw a line then maybe this will help.
Assumes a chartobject on a worksheet. The chart is a Stacked column with
at least 4 categories. It should also have a line already embedded in
the chart.

The SetVline routine allows you to specify the left and right category
that the line is to be positioned between.

'--<Code Start>-----
Sub PlaceVLine()
SetVline ActiveSheet.ChartObjects(1).Chart, 3, 4
End Sub
Sub SetVline(MyChart As Chart, LeftCategory As Integer, RightCategory As
Integer)
'
'Position a vertical line in between Left and Right Category
'
Dim intCatCount As Integer
Dim shpVLine As Shape
Dim sngStep As Single

With MyChart
Set shpVLine = .Shapes(1)
intCatCount = .SeriesCollection(1).Points.Count
If LeftCategory > RightCategory Then Exit Sub
If LeftCategory < 1 Or RightCategory < 1 Then Exit Sub
If LeftCategory > intCatCount Or RightCategory > intCatCount
Then Exit Sub
If .Axes(xlCategory).AxisBetweenCategories Then
sngStep = .PlotArea.InsideWidth / intCatCount
shpVLine.Left = .PlotArea.InsideLeft + (((LeftCategory -
0.5) + ((RightCategory - LeftCategory) / 2)) * sngStep)
Else
sngStep = .PlotArea.InsideWidth / (intCatCount - 1)
shpVLine.Left = .PlotArea.InsideLeft + (((LeftCategory - 1)
+ ((RightCategory - LeftCategory) / 2)) * sngStep)
End If
shpVLine.Width = shpVLine.Width
shpVLine.Top = .PlotArea.InsideTop
shpVLine.Height = .PlotArea.InsideHeight
End With
End Sub
'--<Code End>-----

Cheers
Andy

Holger Gerths wrote:

> Argggh! Of course I do speak about drawing the line with VBA!
> The Problem is that a datapoint object has no VBA-readable position
> properties, only the datalabel has and this is more than unexact!
> :-(
> Holger.
>
>
> "Bernard Liengme" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
>
>>Why not draw the line?
>>If you check the box the place x-axis labels between columns, the exact
>>centre is marked for you
>>Use View|Toolbars to show Drawing toolbar
>>Click on chart to select it (otherwise the line will not be part of the
>>chart)
>>Click the line tool on Drawing toolbar; draw lien. Hold down Shift to help
>>get vertical line
>>
>>Best wishes
>>
>>--
>>Bernard Liengme
>>www.stfx.ca/people/bliengme
>>remove CAPS in e-mail address
>>
>>
>>"Holger Gerths" <(E-Mail Removed)> wrote in message
>>news:On2MX%(E-Mail Removed)...
>>
>>>Hi,
>>>
>>>does anybody know how to find the exact position of a datapoint or a

>>
>>column
>>
>>>in a (stacked) column chart?
>>>The purpose is to place a vertical line (exactly) between to columns.
>>>
>>>Thx, Holger.
>>>
>>>(E-Mail Removed)
>>>
>>>
>>>

>>
>>

>
>


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      21st Apr 2004
Holger -

I have linked you to an answer that has been posted many times. So many
times that I built a web site for it and many of the other answers.

Using a helper series means you don't need to do all the hard algebra to
position your line, and if the scale or size of the plot area changes,
the line is more likely to still be relevant after the change. Andy's
macro might have to be run after each change.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Holger Gerths wrote:

> An answer would be more pleasant!
> But I notice that this is a problem which cannot be solved on the fly.
> :-(((
>
>
> "Jon Peltier" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:%(E-Mail Removed)...
>
>>Or use a helper series:
>>
>> http://peltiertech.com/Excel/Charts/AddLine.html
>>
>>- Jon
>>-------
>>Jon Peltier, Microsoft Excel MVP
>>Peltier Technical Services
>>Tutorials and Custom Solutions
>>http://PeltierTech.com/
>>_______
>>
>>Bernard Liengme wrote:
>>
>>
>>>Why not draw the line?
>>>If you check the box the place x-axis labels between columns, the exact
>>>centre is marked for you
>>>Use View|Toolbars to show Drawing toolbar
>>>Click on chart to select it (otherwise the line will not be part of the
>>>chart)
>>>Click the line tool on Drawing toolbar; draw lien. Hold down Shift to

>
> help
>
>>>get vertical line
>>>
>>>Best wishes
>>>

>>

>
>


 
Reply With Quote
 
Holger Gerths
Guest
Posts: n/a
 
      23rd Apr 2004
Thanks , this was a really useful answer!


"Jon Peltier" <(E-Mail Removed)> schrieb im Newsbeitrag
news:OZ$YPY%(E-Mail Removed)...
> Holger -
>
> I have linked you to an answer that has been posted many times. So many
> times that I built a web site for it and many of the other answers.
>
> Using a helper series means you don't need to do all the hard algebra to
> position your line, and if the scale or size of the plot area changes,
> the line is more likely to still be relevant after the change. Andy's
> macro might have to be run after each change.
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Peltier Technical Services
> Tutorials and Custom Solutions
> http://PeltierTech.com/
> _______
>
> Holger Gerths wrote:
>
> > An answer would be more pleasant!
> > But I notice that this is a problem which cannot be solved on the fly.
> > :-(((
> >
> >
> > "Jon Peltier" <(E-Mail Removed)> schrieb im Newsbeitrag
> > news:%(E-Mail Removed)...
> >
> >>Or use a helper series:
> >>
> >> http://peltiertech.com/Excel/Charts/AddLine.html
> >>
> >>- Jon
> >>-------
> >>Jon Peltier, Microsoft Excel MVP
> >>Peltier Technical Services
> >>Tutorials and Custom Solutions
> >>http://PeltierTech.com/
> >>_______
> >>
> >>Bernard Liengme wrote:
> >>
> >>
> >>>Why not draw the line?
> >>>If you check the box the place x-axis labels between columns, the exact
> >>>centre is marked for you
> >>>Use View|Toolbars to show Drawing toolbar
> >>>Click on chart to select it (otherwise the line will not be part of the
> >>>chart)
> >>>Click the line tool on Drawing toolbar; draw lien. Hold down Shift to

> >
> > help
> >
> >>>get vertical line
> >>>
> >>>Best wishes
> >>>
> >>

> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Datapoint Formatting stefan_haney Microsoft Excel Charting 1 30th Jul 2004 03:00 AM
Getting position of datapoint in stacked column chart Holger Gerths Microsoft Excel Programming 3 15th Mar 2004 09:54 PM
123 Charting - determine the X value of a datapoint Robert Harley Microsoft Excel Charting 0 24th Nov 2003 12:54 PM
Recognize a chart-datapoint for use in vba hglamy Microsoft Excel Charting 4 24th Nov 2003 07:26 AM
chart datapoint color Wolfgang Huell Microsoft Excel Charting 1 15th Sep 2003 08:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:51 AM.