将工具提示分配给mschart中的点(ASP.net c#)

本文关键字:ASP net 分配 工具提示 mschart | 更新日期: 2023-09-27 18:07:07

我需要在将鼠标移动到数据点上时显示工具提示中的值。它显示的值,但值显示在不正确的数据点。y值和轴标签集合为
[237.71, 12:13:58][238.53, 12:28:58][239.95, 12:58:58][238.25 . 1:13:57][240.17 . 1:29 . 01][241.24, 1:58:57],
[243.24 . 2:13:57][243.47, 2:28:58][242.05, 2:58:57]例如,当鼠标移动到237.71数据点上时,它显示238.53。当鼠标移动到241.24数据点上时,它显示242.05。请给我一些建议。

Chart1.Visible = true;
    string startDate = "", EndDate = "";
    Chart1.BackColor = System.Drawing.Color.FromArgb(211, 223, 240); //"#D3DFF0"
    Chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
    Chart1.ChartAreas[0].AxisX.MinorGrid.Enabled = false;
    Chart1.Legends.Add("R Phase");
    Chart1.Series.Add("R Phase");
    Chart1.Series[0].BorderColor = System.Drawing.Color.Transparent;
    Chart1.ChartAreas[0].AxisX.Title = "Time";
    Chart1.ChartAreas[0].AxisY.Title = "Value";
    Chart1.Series[0].ChartType = SeriesChartType.Line;
    Chart1.Series[0].BorderWidth = 3;
    Chart1.Series[0].Color = Color.Maroon;
    Chart1.Series[0].Points.DataBindXY(AxisLabelGrid1, yValueGrid1);
    Chart1.Series[0].IsValueShownAsLabel = true;
    Chart1.Series[0].IsVisibleInLegend = true;
    Chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Auto;
    Chart1.ChartAreas[0].AxisX.Interval = 1.0;
    //Chart1.Series[0].ToolTip = "#VALX - #VALY";
    int i = 0;
    foreach (var pt in Chart1.Series[0].Points)
    {
        string date = GridView1.Rows[i].Cells[0].Text;
       pt.ToolTip = "Value :" + GridView1.Rows[i].Cells[1].Text + "'n Phase : Y Phase";
        if (i == 0)
        {
            startDate = date;
        }
        EndDate = date;
        pt.MarkerColor = System.Drawing.Color.Maroon;
        pt.MarkerSize = 10;
        pt.MarkerStyle = MarkerStyle.Circle;
       // pt.ToolTip = "Value :" + pt.YValues[0].ToString() + "'n Phase : R Phase";
        i++;
    }
    Title tit = new Title("Line chart from " + startDate + " to " + EndDate, Docking.Top, new Font("Garamond", 14), Color.Black);
    Chart1.Titles.Add(tit);

将工具提示分配给mschart中的点(ASP.net c#)

我以前也遇到过类似的问题。

Chart1.Series[0].IsXValueIndexed = false; 
Chart1.Series[0].XValueType = ChartValueType.Time;