Jump to content
Software FX Community

Custom command for Series context menu


User (Legacy)

Recommended Posts

For some reason CommandUIEventArgs is not listed in the docs. I will submit 

this to the doc. people. A link to HitType should have been there but it is

not.

HitType is an enumeration that tells you what was hit. Here are the members:

Background, // Background of the chart

InsideArea, // Background inside the axis area (plot area)

Between, // In a connected chart (e.g. line, area) the hit was made between

two points (e.g. in the area this will be in the section between two points)

Point, // A point marker was hit

Axis, // An axis was hit

Title, // A title was hit

ConstantLine, // A constant Line was hit

Stripe, // A stripe was hit

Drag, // A point marker was hit and it is being dragged (AllowDrag is true)

CrossHair, // A CrossHair is being displayed (CrossHairs=true)

Zoom, // A zoom is being performed

Scroll, // A scroll is being performed

LegendBox, // The legend Box was hit

DataEditor, // The Data editor was hit

Other, // Other object (e.g. annotation object)

AxisSection, // An axis section was hit

In CommandUIEventArgs the object property will contain an object that

depends on the HitType, for example if the LegendBox was hit, the LegendBox

object can be obtained through CommandUIEventArgs.Object. There is no way to

obtain which series was hit. We do not perform this check in the legend box

as out UI does not depend on which series you hit.

--

FP

Software FX

Link to comment
Share on other sites

Your UI does indeed depend on which series was hit. If you right click on a 

series you get the ContextMenuSeries menu. The commands in the

ContextMenuSeries (Gallery, Color, Point labels) work specifically on the

series you clicked. Also the "Properties" command makes the Series page

specifically the series you clicked. You can then change its color, marker

size, etc.

I am asking again: how can I do the same thing in my code? That is if I add

a command to the ContextMenuSeries context menu, how does my command handler

determine which series was clicked?

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

news:o42ppQjKFHA.1012@webserver3.softwarefx.com...

> For some reason CommandUIEventArgs is not listed in the docs. I will

> submit this to the doc. people. A link to HitType should have been there

> but it is not.

>

> HitType is an enumeration that tells you what was hit. Here are the

> members:

>

> Background, // Background of the chart

>

> InsideArea, // Background inside the axis area (plot area)

>

> Between, // In a connected chart (e.g. line, area) the hit was made

> between two points (e.g. in the area this will be in the section between

> two points)

>

> Point, // A point marker was hit

>

> Axis, // An axis was hit

>

> Title, // A title was hit

>

> ConstantLine, // A constant Line was hit

>

> Stripe, // A stripe was hit

>

> Drag, // A point marker was hit and it is being dragged (AllowDrag is

> true)

>

> CrossHair, // A CrossHair is being displayed (CrossHairs=true)

>

> Zoom, // A zoom is being performed

>

> Scroll, // A scroll is being performed

>

> LegendBox, // The legend Box was hit

>

> DataEditor, // The Data editor was hit

>

> Other, // Other object (e.g. annotation object)

>

> AxisSection, // An axis section was hit

>

> In CommandUIEventArgs the object property will contain an object that

> depends on the HitType, for example if the LegendBox was hit, the

> LegendBox object can be obtained through CommandUIEventArgs.Object. There

> is no way to obtain which series was hit. We do not perform this check in

> the legend box as out UI does not depend on which series you hit.

>

> --

> FP

> Software FX

>

Link to comment
Share on other sites

I think I misunderstood your previous posting. I don't know why (after 

reading it again) I though you were referring to right-clicking on the

legend box.

What you are asking for is possible. Here is how you can do it:

1) Capture the MouseDown event and retrieve the Series index from eh

EventArgs. Store it somewhere (e.g. member variable)

2) In the UserCommand event. Use this member stored in (1) to apply it to

the appropriate series.

Example:

private int m_currentSeries= -1;

private void Chart_MouseDown(object sender,

SoftwareFX.ChartFX.MouseEventArgsX e)

{

m_currentSeries = e.Series;

}

private void chart1_UserCommand(object sender,

SoftwareFX.ChartFX.CommandUIEventArgs e) {

if (m_currentSeries != -1) {

chart1.Series[m_currentSeries].Gallery = Gallery.Scatter; // Perform

the opertaion upon m_currentSeries

m_currentSeries =-1;

}

}

--

FP

Software FX

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...