增加c#中的维数

时间:2015-10-07 17:19:10

标签: c# graph

我应该使用什么命令来增加两点之间的间隔?在图上。 我想chart.应该帮助我但究竟是什么?

public static void ShowHeatmap(string title, double[,] heat, int xMin, int yMin)
{
    var chart = new ZedGraphControl()
    {
        Dock = DockStyle.Fill
    };
    var maxHeat = heat.Cast<double>().Max();
    chart.GraphPane.Title.Text = title;
    chart.GraphPane.YAxis.Title.Text = "Дни";
    chart.GraphPane.YAxis.Title.Text = "Месяцы";
    var maxSize = Math.Max(heat.GetLength(0), Math.Pow(heat.GetLength(1),2));
    for (int x = 0; x < heat.GetLength(0); x++)
        for (int y = 0; y < heat.GetLength(1); y++)
        {
            var value = heat[x, y];
            if (value > 1000) throw new ArgumentException("too large heat value " + value);
            var color = Color.FromArgb(255, 200, (int)(255 * value / maxHeat), 0);
            var lineItem = chart.GraphPane.AddCurve("", new double[] { x + xMin }, new double[] { y + yMin }, color);
            lineItem.Symbol.Type = SymbolType.Circle;
            lineItem.Symbol.Fill = new Fill(color);
            lineItem.Symbol.Size = (float)(6000 * value / maxHeat / maxSize);
        }
    chart.GraphPane.YAxis.Scale.MaxAuto = true;
    chart.GraphPane.YAxis.Scale.MinAuto = true;
    chart.AxisChange();
    var form = new Form();
    form.Text = title;
    form.Size = new Size(1920, 1080);
    form.Controls.Add(chart);
    form.ShowDialog();

0 个答案:

没有答案