For Tchart in C#, how to make markstip show out bo

2019-08-08 19:59发布

I have a teechart which has multiple series and I want use the markstip to show out both label value and the series name when mouse over. How could I do that? Chart.Tooltip1 = new Steema.TeeChart.Tools.MarksTip(Chart); Chart.Tooltip1.Style = MarksStyles.Labelvalue; Chart.Tooltip1.GetText += new Steema.TeeChart.(tooltip1_GetText);

标签: c# teechart
1条回答
对你真心纯属浪费
2楼-- · 2019-08-08 20:08

You can use series' GetSeriesMark event for that, for example:

  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
      InitializeChart();
    }

    private void InitializeChart()
    {
      tChart1.Series.Add(new Steema.TeeChart.Styles.Bar()).FillSampleValues();

      tChart1[0].GetSeriesMark += Form1_GetSeriesMark;      
      tChart1[0].Marks.Visible = false;

      tChart1.Tools.Add(new Steema.TeeChart.Tools.MarksTip());
    }

    void Form1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
    {
      e.MarkText = "X: " + series.XValues[e.ValueIndex].ToString() + ", Y: " + series.YValues[e.ValueIndex].ToString() + " - " + series.ToString();
    }    
  }
查看更多
登录 后发表回答