How do I...

N

Neale

Identify a point (peak) on a chart in code. I can select various objects on
the chart, but which object contains the details about the currently selected
item?
 
A

Alvin Bruney - ASP.NET MVP

You can't do that because there is no selection object available - at least,
none that I know of. What are you trying to accomplish? If you want to
target a particular point, you will have to examine the points as they are
rendered.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
N

Neale

I am trying to develop a "zoom" function, whereby when a user clicks or
d-clicks a point on the chart it filters out the unselected items. It seems
strange that you can select individual items on the chart - e.g. legends,
axis, data in series, data points etc. but there is no way to determine which
item has the outline...

I have added the following code to the D-click event of the form that I am
using to display the chart;

Dim ctlCurrentControl As control
Dim strControlName As String
On Error Resume Next
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name

MsgBox "Active Control : " & strControlName

But when I run the form, and try it, strControlName is empty!

By the way, I purchased your book, it's very good, well done.

Alvin Bruney - ASP.NET MVP said:
You can't do that because there is no selection object available - at least,
none that I know of. What are you trying to accomplish? If you want to
target a particular point, you will have to examine the points as they are
rendered.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Neale said:
Identify a point (peak) on a chart in code. I can select various objects on
the chart, but which object contains the details about the currently selected
item?
 
N

Neale

Of course, there is a Resume Next statement there. Without that statement,
error 2474 - The expression you entered requires the control to be in the
active window

I realise that strControlName will be empty when this error occurs given the
code below, but the real issue for me is why can I not identify the selected
item...

Neale said:
I am trying to develop a "zoom" function, whereby when a user clicks or
d-clicks a point on the chart it filters out the unselected items. It seems
strange that you can select individual items on the chart - e.g. legends,
axis, data in series, data points etc. but there is no way to determine which
item has the outline...

I have added the following code to the D-click event of the form that I am
using to display the chart;

Dim ctlCurrentControl As control
Dim strControlName As String
On Error Resume Next
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name

MsgBox "Active Control : " & strControlName

But when I run the form, and try it, strControlName is empty!

By the way, I purchased your book, it's very good, well done.

Alvin Bruney - ASP.NET MVP said:
You can't do that because there is no selection object available - at least,
none that I know of. What are you trying to accomplish? If you want to
target a particular point, you will have to examine the points as they are
rendered.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Neale said:
Identify a point (peak) on a chart in code. I can select various objects on
the chart, but which object contains the details about the currently selected
item?
 
A

Alvin Bruney - ASP.NET MVP

one approach is to use the rangefrompoint or rangefromvalue method - not
sure what the equivalent is for a chart, you may have to look it up (i don't
have access to code at this moment), but essentially, it provides the object
underneath the cursor. So, in theory, when the end-user double-clicks, you
call rangefrompoint to get the object underneath the mouse and simply redraw
it using a different scale. roughly...

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Neale said:
I am trying to develop a "zoom" function, whereby when a user clicks or
d-clicks a point on the chart it filters out the unselected items. It seems
strange that you can select individual items on the chart - e.g. legends,
axis, data in series, data points etc. but there is no way to determine which
item has the outline...

I have added the following code to the D-click event of the form that I am
using to display the chart;

Dim ctlCurrentControl As control
Dim strControlName As String
On Error Resume Next
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name

MsgBox "Active Control : " & strControlName

But when I run the form, and try it, strControlName is empty!

By the way, I purchased your book, it's very good, well done.

Alvin Bruney - ASP.NET MVP said:
You can't do that because there is no selection object available - at least,
none that I know of. What are you trying to accomplish? If you want to
target a particular point, you will have to examine the points as they are
rendered.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Neale said:
Identify a point (peak) on a chart in code. I can select various
objects
on
the chart, but which object contains the details about the currently selected
item?
 
N

Neale

OK then, 1 final question; a ms access form (2003) can be displayed as a
form, p-table or chart - but access also has dataaccesspages which can be
used to place chart objects. I have not used the dataaccesspage, but other
than it being a container object for a chart and allowing for buttons to be
placed on the form next to the chart, is there any difference between the
dataaccesspage and the normal access form.

I'm going to investigate the rangefrompoint further though, thanks for your
help.

Regards

Alvin Bruney - ASP.NET MVP said:
one approach is to use the rangefrompoint or rangefromvalue method - not
sure what the equivalent is for a chart, you may have to look it up (i don't
have access to code at this moment), but essentially, it provides the object
underneath the cursor. So, in theory, when the end-user double-clicks, you
call rangefrompoint to get the object underneath the mouse and simply redraw
it using a different scale. roughly...

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Neale said:
I am trying to develop a "zoom" function, whereby when a user clicks or
d-clicks a point on the chart it filters out the unselected items. It seems
strange that you can select individual items on the chart - e.g. legends,
axis, data in series, data points etc. but there is no way to determine which
item has the outline...

I have added the following code to the D-click event of the form that I am
using to display the chart;

Dim ctlCurrentControl As control
Dim strControlName As String
On Error Resume Next
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name

MsgBox "Active Control : " & strControlName

But when I run the form, and try it, strControlName is empty!

By the way, I purchased your book, it's very good, well done.

Alvin Bruney - ASP.NET MVP said:
You can't do that because there is no selection object available - at least,
none that I know of. What are you trying to accomplish? If you want to
target a particular point, you will have to examine the points as they are
rendered.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Identify a point (peak) on a chart in code. I can select various objects
on
the chart, but which object contains the details about the currently
selected
item?
 
N

Neale

And the answer is;

Dim objSelectedItem As Object

Set objSelectedItem = Form_frmQueryViewer.ChartSpace.Selection
If TypeName(objSelectedItem) = "ChPoint" Then
MsgBox objSelectedItem.GetValue(chDimSeriesNames) & " (Value
Selected : " & objSelectedItem.GetValue(chDimValues) & ")"
End If
Set objSelectedItem = Nothing

Yeeha - The selection item is a ChPoint object. Once I saw that I
investigated the methods for the object and hey presto, >>>GetValue<<<.
 
A

Alvin Bruney - ASP.NET MVP

sweet

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top