Jump to content
Software FX Community

Line Chart - Data Editor Highlight Issue


User (Legacy)

Recommended Posts

1. Display a line chart.

2. Display the data editor.

3. Place mouse cursor over column header ... associated portion of series is

highlighted in the line chart.

4. Place mouse cursor over row header ... associated series is

highlighted in the line chart.

5. Using the mouse select a point in the line chart...press shift and left

click.

A context menu is displayed.

6***. Place mouse cursor over column header ... associated portion of series

is no longer highlighted in the line chart.

7***. Place mouse cursor over row header ... associated series is no

longer highlighted in the line chart.

The following code is the event handler for the mouse click.

Any suggestions on what might be wrong in my code or is this a ChartFX

problem?

private void Chart_MouseDown(object sender,

SoftwareFX.ChartFX.MouseEventArgsX e)

{

if (e.Button == System.Windows.Forms.MouseButtons.Left)

{

try

{

switch (e.HitType)

{

case SoftwareFX.ChartFX.HitType.Point:

int ix = 0;

this.mnuPopup.MenuItems.Clear();

SoftwareFX.ChartFX.Chart chart = (SoftwareFX.ChartFX.Chart)sender;

DataTable dt = (DataTable)chart.DataSource;

if (e.Point > -1)

{

System.DateTime dateTime = (DateTime)dt.Rows[e.Point]["StartTime"];

this.mnuPopup.MenuItems.Add ("Set Start Time: " +

dateTime.ToString(DATETIMEFORMAT));

this.mnuPopup.MenuItems[ix].Click += new EventHandler(mnuPopup_Click);

ix++;

this.mnuPopup.MenuItems.Add ("Set Stop Time: " +

dateTime.ToString(DATETIMEFORMAT));

this.mnuPopup.MenuItems[ix].Click += new EventHandler(mnuPopup_Click);

ix++;

}

if (e.Series > -1)

{

string param = dt.Columns[e.Series].ToString();

this.mnuPopup.MenuItems.Add ("Disable Criteria: " +

GetSourceNameFromColumnHeader(param));

this.mnuPopup.MenuItems[ix].Click += new EventHandler(mnuPopup_Click);

ix++;

}

System.Drawing.Point point;

if (e.HitType == SoftwareFX.ChartFX.HitType.DataEditor)

{

point = new

Point(this.ChartLine.Width-this.ChartLine.DataEditorObj.Width+e.X,this.Chart

Line.Height-this.ChartLine.DataEditorObj.Height+e.Y);

}

else

{

point = new System.Drawing.Point(e.X,e.Y);

}

this.mnuPopup.Show ((System.Windows.Forms.Control)sender,point);

e.Handled = true;

break;

}

}

catch

{

//Ignore any exception case we haven't thought of

//Possibly trace the tooltiptext and error for future enhancement

}

}

}

Link to comment
Share on other sites

bump...

"jmw" <Joseph.Wilton@unisys.com> wrote in message

news:fwhZgBr3EHA.3492@webserver3.softwarefx.com...

> 1. Display a line chart.

> 2. Display the data editor.

> 3. Place mouse cursor over column header ... associated portion of series

is

> highlighted in the line chart.

> 4. Place mouse cursor over row header ... associated series is

> highlighted in the line chart.

> 5. Using the mouse select a point in the line chart...press shift and left

> click.

> A context menu is displayed.

> 6***. Place mouse cursor over column header ... associated portion of

series

> is no longer highlighted in the line chart.

> 7***. Place mouse cursor over row header ... associated series is no

> longer highlighted in the line chart.

>

> The following code is the event handler for the mouse click.

> Any suggestions on what might be wrong in my code or is this a ChartFX

> problem?

>

>

> private void Chart_MouseDown(object sender,

> SoftwareFX.ChartFX.MouseEventArgsX e)

> {

> if (e.Button == System.Windows.Forms.MouseButtons.Left)

> {

> try

> {

> switch (e.HitType)

> {

> case SoftwareFX.ChartFX.HitType.Point:

> int ix = 0;

> this.mnuPopup.MenuItems.Clear();

> SoftwareFX.ChartFX.Chart chart = (SoftwareFX.ChartFX.Chart)sender;

> DataTable dt = (DataTable)chart.DataSource;

> if (e.Point > -1)

> {

> System.DateTime dateTime = (DateTime)dt.Rows[e.Point]["StartTime"];

> this.mnuPopup.MenuItems.Add ("Set Start Time: " +

> dateTime.ToString(DATETIMEFORMAT));

> this.mnuPopup.MenuItems[ix].Click += new

EventHandler(mnuPopup_Click);

> ix++;

> this.mnuPopup.MenuItems.Add ("Set Stop Time: " +

> dateTime.ToString(DATETIMEFORMAT));

> this.mnuPopup.MenuItems[ix].Click += new

EventHandler(mnuPopup_Click);

> ix++;

> }

> if (e.Series > -1)

> {

> string param = dt.Columns[e.Series].ToString();

> this.mnuPopup.MenuItems.Add ("Disable Criteria: " +

> GetSourceNameFromColumnHeader(param));

> this.mnuPopup.MenuItems[ix].Click += new

EventHandler(mnuPopup_Click);

> ix++;

> }

> System.Drawing.Point point;

> if (e.HitType == SoftwareFX.ChartFX.HitType.DataEditor)

> {

> point = new

>

Point(this.ChartLine.Width-this.ChartLine.DataEditorObj.Width+e.X,this.Chart

> Line.Height-this.ChartLine.DataEditorObj.Height+e.Y);

> }

> else

> {

> point = new System.Drawing.Point(e.X,e.Y);

> }

> this.mnuPopup.Show ((System.Windows.Forms.Control)sender,point);

> e.Handled = true;

> break;

> }

> }

> catch

> {

> //Ignore any exception case we haven't thought of

> //Possibly trace the tooltiptext and error for future enhancement

> }

> }

> }

>

>

Link to comment
Share on other sites

Thanks....four easy replacements of Down to Up and it works great.

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

news:9l0$BK44EHA.1580@webserver3.softwarefx.com...

> Simply move your code to the MouseUp event instead and you will avoid this

> problem.

>

> Notice that Context menus in Windows show on MouseUp not on MouseDown.

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...