Profile Picture

Set Hand Cursor for Legend Item

Posted By Alexander Haberl 3 Years Ago
Author
Message
Alexander Haberl
Problem Posted 3 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 15, Visits: 48
I cannot set a Hand Cursor for an automatic LegendItem. Is this possible?

I tried this approach (the changing of the Font to an underlined Font works):

 
  private void ChartControl_MouseMove(object sender, MouseEventArgs e)
   {
    NHitTestResult res = null;

    try
    {
      res = HitTest(e.X, e.Y);
    }
    catch (Exception)
    {

    }

    if (null != res)
    {
      if (res.ChartElement == ChartElement.LegendDataItem)
      {
       for (int i = 0; i < Charts.Count; i++)
       {
        foreach (NSeriesBase s in Charts[i].Series)
        {
          NSeriesLegend seriesLegend = s.Legend;
          seriesLegend.TextStyle.FontStyle.Style = FontStyle.Regular;
        }
       }

       res.LegendDataItem.TextStyle.FontStyle.Style = FontStyle.Underline;

       res.LegendDataItem.InteractivityStyle.Cursor.Type = CursorType.Hand;

       resetLegend = true;

       Refresh();
      }
      else
      {
       if (resetLegend)
       {
        for (int i = 0; i < Charts.Count; i++)
        {
          foreach (NSeriesBase s in Charts[i].Series)
          {
           NSeriesLegend seriesLegend = s.Legend;
           seriesLegend.TextStyle.FontStyle.Style = FontStyle.Regular;
          }
        }

        Refresh();
        resetLegend = false;
       }
      }
    }
   }



Nevron Support
Posted 3 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 3,054, Visits: 4,009
Hi Alexander,

Generally, you should not modify the attributes of automatically generated legend items, because in the general case they are clones of series legend attributes. Instead, you can simply create a legend with custom items. You can check out the Panels \ Legend \ Custom Legend Items example on how to generate custom legend items. 

We hope this helps - let us know if you have any questions.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic