PC Review


Reply
Thread Tools Rate Thread

Additional lines on the chart

 
 
kzalewski@sisco.pl
Guest
Posts: n/a
 
      26th Mar 2007
Hello,

I have to draw additional lines on the chart from VBA level. I know
the value on the X axis (from data sheet, of course) but I don't know
where this value will be displayed on the chart. Therefore I don't
know where to start drawing. Is there any possibility to access from
VBA to the position of the given value on the X axis?

Regards,

Krzysiek

 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      26th Mar 2007
Add a series using the endpoints of the line to be added, using data you've
calculated in the sheet. Drawing lines (shapes) is likely to cause pain if
the other data changes.

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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I have to draw additional lines on the chart from VBA level. I know
> the value on the X axis (from data sheet, of course) but I don't know
> where this value will be displayed on the chart. Therefore I don't
> know where to start drawing. Is there any possibility to access from
> VBA to the position of the given value on the X axis?
>
> Regards,
>
> Krzysiek
>



 
Reply With Quote
 
kzalewski@sisco.pl
Guest
Posts: n/a
 
      27th Mar 2007
Jon,

Thank you for clue.

I have to draw 2 lines to visualize the range of accepted values from
the X series. Therefore I need to calculate 2 points (x1,y1) as the
beginning of left, minimum line (left top point) and (x2,y2) as the
end of right, maximum line (right bottom point) and then draw the
lines from (x1,y1) to (x1,y2) and from (x2,y1) to (x2,y2). X series
can be displayed from Window_min to Window_max. Values in this series
has step as Divider. Lines must be drawn in position Range_min and
Range_max (values from X series).I resolved this problem as below:

Number_1 = (Window_max - Window_min) / Divider + 1
Number_2 = Chart.Axes(1).Width / Number_1
x1 = Chart.Axes(1).Left + ((Range_min - Window_min) *
Number_2) / Divider
x2 = Chart.Axes(1).Left + ((Range_max - Window_min) *
Number_2) / Divider
y1 = Chart.PlotArea.Top
y2 = Chart.Axes(1).Top
Chart.Shapes.AddLine(x1, y1, x1, y2)
Chart.Shapes.AddLine(x2, y1, x2, y2)

To be harder, I generate the chart form Access based on values from
given table. Because I can have many Yseries, total chart can be not
readable. I'm thinking to add checkboxes for each Yseries to show/hide
activity. And there is next problem: how to add VBA code to
particular checkbox in Excel from VBA code in Access. Do you have any
suggestions?

Regards,

Krzysiek

On 26 Mar, 19:00, "Jon Peltier" <jonxlmv...@SPAMpeltiertech.com>
wrote:
> Add a series using the endpoints of the line to be added, using data you've
> calculated in the sheet. Drawing lines (shapes) is likely to cause pain if
> the other data changes.
>
> - Jon
> -------
> Jon Peltier, Microsoft Excel MVP
> Tutorials and Custom Solutionshttp://PeltierTech.com
> _______
>
> <kzalew...@sisco.pl> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > Hello,

>
> > I have to draw additional lines on the chart from VBA level. I know
> > the value on the X axis (from data sheet, of course) but I don't know
> > where this value will be displayed on the chart. Therefore I don't
> > know where to start drawing. Is there any possibility to access from
> > VBA to the position of the given value on the X axis?

>
> > Regards,

>
> > Krzysiek- Ukryj cytowany tekst -

>
> - Pokaż cytowany tekst -



 
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
In Excel 2007 chart with multiple lines, mouse doesn't track lines sfuelling Microsoft Excel Charting 1 19th Aug 2009 09:41 PM
additional lines from filters =?Utf-8?B?QmxleXM0NDQ=?= Microsoft Excel Misc 0 25th Apr 2007 02:16 PM
macro to add additional lines =?Utf-8?B?QnJhZA==?= Microsoft Excel Programming 2 14th Dec 2004 02:12 PM
Additional Detail Lines Antony Elson Microsoft Access Forms 3 23rd Aug 2004 03:58 PM
Additional Detail Lines Antony Elson Microsoft Access Forms 0 20th Aug 2004 11:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:59 AM.