Jump to content
Software FX Community

DataGrids with custom labels


Recommended Posts

Hello,

My goal is to have the data grid have custom labels (for example 2 rows of

labeling as you might have in an OLAP application where two "dimensions" are

being show.

We are encountering numerous difficulties that may prevent us from using the

DataGrid at all.

1) PostPaint seems to only be thrown for the chart itself, not for Docable

components such as the LegendBox or DataGrid.

1a) the passed Graphics context (logically) clips at the chart borders

and doesn't allow for painting over the grid in the first place.

2) While the XAxis labels can be turned off it seems that the series labels

cannot be.

3) It seems impossible to determine the exact location of the data grid.

The proterties to expose this seem to be missing and even a binary search

approach using HitTest & checking the HitType == HitType.DataGrid fails as

HitTypeBackground is returned when the simulated click is within the

boundaries of the DataGrid.

Have I missed anything that would allow me to "owner-draw" the XValue labels

(they need N rows, not just one) & Series labels (they need N columns, not

just 1) of the DaytaGrid?

Kind Regards,

Jesse

Link to post
Share on other sites

The DataGrid just doesn't have those capabilities, the DataGrid is meant as 

a very simple way of showing the chart's data in a tabular format, it is by

no means a full-blown grid control.

You may want to use a grid control attached to the same data instead of our

DataGrid.

--

Francisco Padron

www.chartfx.com

Link to post
Share on other sites

Fair enough, thank you for the reply.  Done.

In so doing I encounter another delema, however. Namely how to tie the

highlighting between the 3rd party grid control and the ChartFX chart

control. It is straight forward to "highlight" columns / rows in the grid

based on highlights occuring within the chart (using the Highlighting event)

but I see no way to tell the chart what to highlight. Without that I cannot

have selection changes in the grid cause highlighing in the chart (as does

happen with your built in DataGrid). That is such a great visualization

helper for users I am loath to go without it. Have I missed some method or

property that allows for programmatic highlighting? If not is this a

planned feature for the near future?

Cheers,

Jesse McDaniel

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

news:znkXtGNLGHA.2236@webserver3.softwarefx.com...

> The DataGrid just doesn't have those capabilities, the DataGrid is meant

> as a very simple way of showing the chart's data in a tabular format, it

> is by no means a full-blown grid control.

>

> You may want to use a grid control attached to the same data instead of

> our DataGrid.

>

> --

> Francisco Padron

> www.chartfx.com

>

Link to post
Share on other sites

Appologies for the last message.

I found the following in another thread: RE: a HighlightItem method.

We are routing the request to purchase your software within our organization

right now. Once we have purchased license(s) am I correct in assuming we

could be given access to this hot fix also?

Thank you,

Jesse

>>>

Ok you're right.

It was checked into sourcesafe on 12/14/2005

We will have to provide you a hotfix if you want it.

I will have support contact you shortly.

-c

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

news:znkXtGNLGHA.2236@webserver3.softwarefx.com...

> The DataGrid just doesn't have those capabilities, the DataGrid is meant

> as a very simple way of showing the chart's data in a tabular format, it

> is by no means a full-blown grid control.

>

> You may want to use a grid control attached to the same data instead of

> our DataGrid.

>

> --

> Francisco Padron

> www.chartfx.com

>

Link to post
Share on other sites

Although we are very happy you are purchasing our product right now, we can 

give you access to the hotfix even if you are using a trial version.

I am emailing links to the hotfix to the address you are using in your

posts, if you do not receive it please send an email to support at

softwarefx dot com and mention this thread.

--

JC

Software FX Support

"Jesse McDaniel" <jmcdaniel@stayinfront.com> wrote in message

news:VWMhBoPLGHA.2568@webserver3.softwarefx.com...

> Appologies for the last message.

>

> I found the following in another thread: RE: a HighlightItem method.

> We are routing the request to purchase your software within our

> organization right now. Once we have purchased license(s) am I correct in

> assuming we could be given access to this hot fix also?

>

> Thank you,

> Jesse

>

>>>>

>

> Ok you're right.

> It was checked into sourcesafe on 12/14/2005

> We will have to provide you a hotfix if you want it.

> I will have support contact you shortly.

> -c

>

>

>

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

> news:znkXtGNLGHA.2236@webserver3.softwarefx.com...

>> The DataGrid just doesn't have those capabilities, the DataGrid is meant

>> as a very simple way of showing the chart's data in a tabular format, it

>> is by no means a full-blown grid control.

>>

>> You may want to use a grid control attached to the same data instead of

>> our DataGrid.

>>

>> --

>> Francisco Padron

>> www.chartfx.com

>>

>

>

Link to post
Share on other sites

Thank you.  I received your email & upgraded the component.

I do now see the HighlightItem method, however I am unable to highlight

anything in the chart using it. Hopefully I am just doing something wrong -

if so please let me know what that is.

Thank you kindly,

Jesse McDaniel

A reduced case of me code would be as follows. It executes w/o exception or

any effect that I can observe.

ChartFX.WinForms.Internal.IHitTestElement elem = chart.Points[0, 0]; // or

chart.Series[0];

//ea.Resolver = new

ChartFX.WinForms.Internal.Highlight.PointAttributesResolver(chart,

chart.Points[0, 0]); // tried w/ and w/o this

//ea.Resolver = new

ChartFX.WinForms.Internal.Highlight.SeriesPointResolver(chart, 0, 0, false);

// or w/ and w/o this for Series...

HighlightingEventArgs ea = new HighlightingEventArgs(elem);

chart.Highlight.HighlightItem(ea);

note that the documentation mentiones the following, which wond't compile as

it doesn't match the actual prototypes in a could of ways.

HighlightEventArgs ea = new HighlightEventArgs(HighlightModes.Dimmed,0,0);

chart1.Highlight.HighlightItem(this, ea);

// note: there is no method taking 2 arguments, only 1 taking

ChartFX.WinForms.HighlightingEventArgs, not HighliteEventArgs

public void HighlightItem(object sender, HighlightEventArgs args);

"Software FX Support" <none@noreply.com> wrote in message

news:2PfcKIQLGHA.4024@webserver3.softwarefx.com...

> Although we are very happy you are purchasing our product right now, we

> can give you access to the hotfix even if you are using a trial version.

>

> I am emailing links to the hotfix to the address you are using in your

> posts, if you do not receive it please send an email to support at

> softwarefx dot com and mention this thread.

>

> --

> JC

> Software FX Support

> "Jesse McDaniel" <jmcdaniel@stayinfront.com> wrote in message

> news:VWMhBoPLGHA.2568@webserver3.softwarefx.com...

>> Appologies for the last message.

>>

>> I found the following in another thread: RE: a HighlightItem method.

>> We are routing the request to purchase your software within our

>> organization right now. Once we have purchased license(s) am I correct

>> in assuming we could be given access to this hot fix also?

>>

>> Thank you,

>> Jesse

>>

>>>>>

>>

>> Ok you're right.

>> It was checked into sourcesafe on 12/14/2005

>> We will have to provide you a hotfix if you want it.

>> I will have support contact you shortly.

>> -c

>>

>>

>>

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

>> news:znkXtGNLGHA.2236@webserver3.softwarefx.com...

>>> The DataGrid just doesn't have those capabilities, the DataGrid is meant

>>> as a very simple way of showing the chart's data in a tabular format, it

>>> is by no means a full-blown grid control.

>>>

>>> You may want to use a grid control attached to the same data instead of

>>> our DataGrid.

>>>

>>> --

>>> Francisco Padron

>>> www.chartfx.com

>>>

>>

>>

>

>

Link to post
Share on other sites

RE: Previous Post:  Well.. after casting things I manage to cause some 

highlighting to occur... but never more than one point at a time (ie a whole

series or xvalue set of data)... the following will do that minimal

highlighting, but despoite the loops present only the last call to

HighlightItem is highlighted.

Can HighlightItem be used for the highlighting of an entire series at all?

what of XValues? or arbitrary sets of points?

Thanks for any information you might have,

Jesse McDaniel

HighlightEventArgs ea = new HighlightEventArgs(HighlightModes.Dimmed);

IHighlightManager mgr = chart.Highlight;

if (row >= 0 && col >= 0)

{

ea.Resolver = new PointAttributesResolver(this.chart,

chart.Points[col, row]);

mgr.HighlightItem(this, ea);

}

else if (row >= 0)

{

for (int i = 0; i < grid.ColumnCount - m_headerColumns; i++)

{

ea.Resolver = new SeriesPointResolver(this.chart, i, row,

false);

mgr.HighlightItem(this, ea);

}

}

else if (col >= 0)

{

for (int i = 0; i < grid.RowCount; i++)

{

ea.Resolver = new SeriesPointResolver(this.chart, col, i, false);

mgr.HighlightItem(this, ea);

}

}

"Software FX Support" <none@noreply.com> wrote in message

news:2PfcKIQLGHA.4024@webserver3.softwarefx.com...

> Although we are very happy you are purchasing our product right now, we

> can give you access to the hotfix even if you are using a trial version.

>

> I am emailing links to the hotfix to the address you are using in your

> posts, if you do not receive it please send an email to support at

> softwarefx dot com and mention this thread.

>

> --

> JC

> Software FX Support

> "Jesse McDaniel" <jmcdaniel@stayinfront.com> wrote in message

> news:VWMhBoPLGHA.2568@webserver3.softwarefx.com...

>> Appologies for the last message.

>>

>> I found the following in another thread: RE: a HighlightItem method.

>> We are routing the request to purchase your software within our

>> organization right now. Once we have purchased license(s) am I correct

>> in assuming we could be given access to this hot fix also?

>>

>> Thank you,

>> Jesse

>>

>>>>>

>>

>> Ok you're right.

>> It was checked into sourcesafe on 12/14/2005

>> We will have to provide you a hotfix if you want it.

>> I will have support contact you shortly.

>> -c

>>

>>

>>

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

>> news:znkXtGNLGHA.2236@webserver3.softwarefx.com...

>>> The DataGrid just doesn't have those capabilities, the DataGrid is meant

>>> as a very simple way of showing the chart's data in a tabular format, it

>>> is by no means a full-blown grid control.

>>>

>>> You may want to use a grid control attached to the same data instead of

>>> our DataGrid.

>>>

>>> --

>>> Francisco Padron

>>> www.chartfx.com

>>>

>>

>>

>

>

Link to post
Share on other sites

Note: we are getting deep into undocumented territory.

To interact with highlighting you need many declarations (classes,

interfaces, etc.) from a namespace called

ChartFX.WinForms.Internal.Highlight. ChartFX when highlighting maintains 1

(and only 1) resolver who is responsible for deciding what should be

highlighted, i.e. calling HighlightItem replaces the previous resolver.

To highlight a particular series (Note the use of -1 for the point index)

using ChartFX.WinForms.Internal.Highlight;

...

HighlightEventArgs highlightArgs = new HighlightEventArgs();

highlightArgs.Resolver = new SeriesPointResolver(chart1,nSeries,-1,true);

IHighlightManager highlightManager = chart1.Highlight;

highlightManager.HighlightItem(null, highlightArgs);

Identically if you wanted to highlight all the markers that correspond to

point X regardless of the series you would use -1 as the series parameter.

Obviously you can highlight a particular series/point combination by

providing both indexes.

If you mouse over our Y axis you will notice we highlight all values greater

than the specific value you are over, to do that you would modify the

resolver from the previous code as follows

highlightArgs.Resolver = new AxisValueResolver(chart1, chart1.AxisY, 58,

HighlightCondition.GreaterThan, true);

In all these cases note that you are asking ChartFX to highlight something

but moving the mouse over the chart will clear the highlight, if you want at

some point to keep the highlight regardless of mouse movements you would do

chart1.Highlight.Enabled = false;

chart1.Highlight.ClearHighlight(null);

Finally if you actually need to highlight an "arbitrary" set of points you

can implement IHighlightResolver in a class. In the following example we

highlight when the point index is equal to the series index (see GetState

function).

internal class MyResolver : IHighlightResolver

{

Highlightable IHighlightResolver.CanHighlight(HighlightType itemType,

object item)

{

if (itemType == HighlightType.SeriesPoint)

return Highlightable.Yes;

return Highlightable.No;

}

HighlightingEventArgs IHighlightResolver.GetHighlightingEventArgs()

{

return null;

}

HighlightState IHighlightResolver.GetState(HighlightType itemType,

object item)

{

if (itemType != HighlightType.SeriesPoint)

return HighlightState.Normal;

SeriesPointInfo seriesPoint = (SeriesPointInfo)item;

return (seriesPoint.Series == seriesPoint.Point) ?

HighlightState.Highlighted : HighlightState.Dimmed;

}

bool IHighlightResolver.OnKey(bool down, KeyEventArgs args)

{

return false;

}

}

Hope this helps.

--

JC

Software FX Support

"Jesse McDaniel" <jmcdaniel@stayinfront.com> wrote in message

news:pIh3jgTLGHA.1888@webserver3.softwarefx.com...

> RE: Previous Post: Well.. after casting things I manage to cause some

> highlighting to occur... but never more than one point at a time (ie a

> whole series or xvalue set of data)... the following will do that minimal

> highlighting, but despoite the loops present only the last call to

> HighlightItem is highlighted.

> Can HighlightItem be used for the highlighting of an entire series at all?

> what of XValues? or arbitrary sets of points?

>

> Thanks for any information you might have,

> Jesse McDaniel

>

> HighlightEventArgs ea = new HighlightEventArgs(HighlightModes.Dimmed);

>

> IHighlightManager mgr = chart.Highlight;

>

> if (row >= 0 && col >= 0)

>

> {

>

> ea.Resolver = new PointAttributesResolver(this.chart,

> chart.Points[col, row]);

>

> mgr.HighlightItem(this, ea);

>

> }

>

> else if (row >= 0)

>

> {

>

> for (int i = 0; i < grid.ColumnCount - m_headerColumns; i++)

>

> {

>

> ea.Resolver = new SeriesPointResolver(this.chart, i, row,

> false);

>

> mgr.HighlightItem(this, ea);

>

> }

>

> }

>

> else if (col >= 0)

>

> {

>

> for (int i = 0; i < grid.RowCount; i++)

>

> {

>

> ea.Resolver = new SeriesPointResolver(this.chart, col, i, false);

>

> mgr.HighlightItem(this, ea);

>

> }

>

> }

>

>

> "Software FX Support" <none@noreply.com> wrote in message

> news:2PfcKIQLGHA.4024@webserver3.softwarefx.com...

>> Although we are very happy you are purchasing our product right now, we

>> can give you access to the hotfix even if you are using a trial version.

>>

>> I am emailing links to the hotfix to the address you are using in your

>> posts, if you do not receive it please send an email to support at

>> softwarefx dot com and mention this thread.

>>

>> --

>> JC

>> Software FX Support

>> "Jesse McDaniel" <jmcdaniel@stayinfront.com> wrote in message

>> news:VWMhBoPLGHA.2568@webserver3.softwarefx.com...

>>> Appologies for the last message.

>>>

>>> I found the following in another thread: RE: a HighlightItem method.

>>> We are routing the request to purchase your software within our

>>> organization right now. Once we have purchased license(s) am I correct

>>> in assuming we could be given access to this hot fix also?

>>>

>>> Thank you,

>>> Jesse

>>>

>>>>>>

>>>

>>> Ok you're right.

>>> It was checked into sourcesafe on 12/14/2005

>>> We will have to provide you a hotfix if you want it.

>>> I will have support contact you shortly.

>>> -c

>>>

>>>

>>>

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

>>> news:znkXtGNLGHA.2236@webserver3.softwarefx.com...

>>>> The DataGrid just doesn't have those capabilities, the DataGrid is

>>>> meant as a very simple way of showing the chart's data in a tabular

>>>> format, it is by no means a full-blown grid control.

>>>>

>>>> You may want to use a grid control attached to the same data instead of

>>>> our DataGrid.

>>>>

>>>> --

>>>> Francisco Padron

>>>> www.chartfx.com

>>>>

>>>

>>>

>>

>>

>

>

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...