Jump to content
Software FX Community

How to not highlight a particular series


David V

Recommended Posts

I want to be able to unhighlight a particular series.

Currentlt I am doing the following

private void chart1_Highlighting(object sender, HighlightingEventArgs e)

{

Debug

.WriteLine(string.Format("Highlighting {0}",e.Series));

if (e.Series ==1){

chart1.Highlight.ClearHighlight(sender);

}

} 

but the problem is the other series don't get highlighted again, unless I click the chart again. I can see the highlight event stop firring.

Link to comment
Share on other sites

I fixed it by replacing the resolver

  if (e.Series ==1)

{

  if (!(e.Resolver is NullHighlightResolver))

  {

if (_nullHighlightResolver == null)

{

 _nullHighlightResolver = new NullHighlightResolver(e.Resolver);

}

e.Resolver = _nullHighlightResolver;

  }

 //Disable hightlight on an item

public class NullHighlightResolver : IHighlightResolver

{

 private readonly IHighlightResolver _resolver;

 public NullHighlightResolver(IHighlightResolver resolver_)

 {

_resolver = resolver_;

 }

 public HighlightState GetState(HighlightType itemType, object item)

 {

return HighlightState.Never;

 }

 public Highlightable CanHighlight(HighlightType itemType, object item)

 {

return Highlightable.No;

 }

 public bool OnKey(bool down, KeyEventArgs args)

 {

return _resolver.OnKey(down, args);

 }

 public HighlightingEventArgs GetHighlightingEventArgs()

 {

return _resolver.GetHighlightingEventArgs();

 }

}

Link to comment
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.

×
×
  • Create New...