Jump to content
Software FX Community

Creating custom context menu?


User (Legacy)

Recommended Posts

I have a ChartFX Gantt chart for which I'd like to implement a custom

right-click context menu. The menu would be active over all points on the

chart. Each menu option would call a javascript function which would perform

a task dependent on the chart point (i.e. I need to be able to identify

which point the right-click was made on).

Is this possible? Are there any examples?

Thank you.

Link to comment
Share on other sites

Sorry, I forgot to mention... ASP.NET .

"John Smith" <JSmith@Phoney.com> wrote in message

news:8rww0PeKDHA.644@webserver1.softwarefx.com...

> I have a ChartFX Gantt chart for which I'd like to implement a custom

> right-click context menu. The menu would be active over all points on the

> chart. Each menu option would call a javascript function which would

perform

> a task dependent on the chart point (i.e. I need to be able to identify

> which point the right-click was made on).

>

> Is this possible? Are there any examples?

>

> Thank you.

>

>

post-2107-13922394676772_thumb.jpg

Link to comment
Share on other sites

I don't think this will be possible as the support for Client Side events

for .NET components is limited in the current version of Internet Explorer.

Because IE has not access the .NET framework object model, it renders most

events and methods inaccessible.

In this particular case, what you would normally do (working in a container

that fully support the .NET framework) is to capture the MouseDown event, in

particular the Right-Click and store the Series and Point index, later when

you receive your custom command through the UserCommand event, you will know

which series was selected.

However, the UserCommand event passes you a class as a parameter which makes

it impossible to capture it under IE. IE will only support event with single

types (integers, strings, etc.).

However, I have to admit that my knowledge of how IE interacts with .NET

components is limited by the lack of documentation in this issue and I still

find some new things from time to time.

I will ask around to other developers here that have more experience on

dealing with this issues. I recommend you contact our Priority Support

department (over the phone or by e-mail) to see if they have any solutions

to offer.

I hope that while not solving your problem this sheds some light on the

complexity of the problem and the reasons for it.

Please keep us in this newsgroup posted on your progress.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Thank you for your reply.

I did get this working, but I am not confident it is a good solution. What I

did was to hack the chart Url and UrlParamMask properties to output an

OnMouseDown attribute into the imagemap area tags. I used this code (C#):

MyChart.URL = "#";

MyChart.URLParamMask = "\" onmousedown=\"return chartmenushow(event);";

chartmenushow is a client-side javascript function that tests the event

parameter to see which mouse button was pressed. The function also uses the

event.srcElement.title to extract the chart point from the imagemap area

tooltip. (By the way, area tags do not respond to OnContextMenu events).

I feel it would be a nice enhancement if ChartFX provided native support for

rendering onmousedown attributes (or indeed any attributes, including custom

point locators) into a chart's imagemap area tags.

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

news:eBekCbeLDHA.1284@webserver1.softwarefx.com...

> I don't think this will be possible as the support for Client Side events

> for .NET components is limited in the current version of Internet

Explorer.

> Because IE has not access the .NET framework object model, it renders most

> events and methods inaccessible.

>

> In this particular case, what you would normally do (working in a

container

> that fully support the .NET framework) is to capture the MouseDown event,

in

> particular the Right-Click and store the Series and Point index, later

when

> you receive your custom command through the UserCommand event, you will

know

> which series was selected.

>

> However, the UserCommand event passes you a class as a parameter which

makes

> it impossible to capture it under IE. IE will only support event with

single

> types (integers, strings, etc.).

>

> However, I have to admit that my knowledge of how IE interacts with .NET

> components is limited by the lack of documentation in this issue and I

still

> find some new things from time to time.

>

> I will ask around to other developers here that have more experience on

> dealing with this issues. I recommend you contact our Priority Support

> department (over the phone or by e-mail) to see if they have any solutions

> to offer.

>

> I hope that while not solving your problem this sheds some light on the

> complexity of the problem and the reasons for it.

>

> Please keep us in this newsgroup posted on your progress.

>

> --

> FP

> Software FX, Inc.

>

>

post-2107-13922394679683_thumb.gif

Link to comment
Share on other sites

Great Idea !

You can actually include MACROS in your URLParam mask that will provide you

with information about the point what was clicked like the label, the value,

the index, etc.

The macros start with % and can be any of the following (documented in the

help file):

l Shows X-Axis Legend.

k Shows X-Axis Key Legend.

s Shows Series Legend.

S Shows Series Index.

x Shows XValue (XY charts, when they were set with X values).

i Shows IniValues (Gantt).

v Shows Data Value.

n <n> For types that require more than one series, these are replaced by the

value of each one. (n represents an index).

t Series Total (Sum of all points in this series).

p Percentage of total this point represents (Pie).

T Point Total (Sum of all series for this point).

P Percentage of total this series represents (Used in stacked charts).

X displays the marker X value for any chart type including those that do not

support X values such as bar.

N Shows the index for the point.

L Shows the Tag string of the Point object.

So you could actually do something like:

MyChart.URLParamMask = "\" onmousedown=\"return

chartmenushow(event,%l,%s);";

And obtain these strings as parameters you your script function.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

Good idea too. Thanks.

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

news:10VYfLDMDHA.644@webserver1.softwarefx.com...

> Great Idea !

>

> You can actually include MACROS in your URLParam mask that will provide

you

> with information about the point what was clicked like the label, the

value,

> the index, etc.

>

> The macros start with % and can be any of the following (documented in the

> help file):

>

> l Shows X-Axis Legend.

> k Shows X-Axis Key Legend.

> s Shows Series Legend.

> S Shows Series Index.

> x Shows XValue (XY charts, when they were set with X values).

> i Shows IniValues (Gantt).

> v Shows Data Value.

> n <n> For types that require more than one series, these are replaced by

the

> value of each one. (n represents an index).

> t Series Total (Sum of all points in this series).

> p Percentage of total this point represents (Pie).

> T Point Total (Sum of all series for this point).

> P Percentage of total this series represents (Used in stacked charts).

> X displays the marker X value for any chart type including those that do

not

> support X values such as bar.

> N Shows the index for the point.

> L Shows the Tag string of the Point object.

>

> So you could actually do something like:

>

> MyChart.URLParamMask = "\" onmousedown=\"return

> chartmenushow(event,%l,%s);";

>

>

> And obtain these strings as parameters you your script function.

>

> --

> 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...