1
當我試圖用我的圖形初始化表單時,我總是收到這個錯誤。無法找出解決方法。認爲它與數據綁定有關在winform上創建折線圖時出錯
任何想法?
這裏是我的代碼 -
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace NoCAnalysisTool2
{
public partial class Visualisation : UserControl
{
public string tx_graph { get; set; }
public List<int> tx_graphData { get; set; }
public Visualisation(string txGraph, List<int> tx_GData)
{
InitializeComponent();
tx_graph = txGraph;
tx_graphData = tx_GData;
// Set 3D chart settings
chart1.ChartAreas["Default"].Area3DStyle.Enable3D = true;
chart1.ChartAreas["Default"].Area3DStyle.IsRightAngleAxes = false;
chart1.ChartAreas["Default"].Area3DStyle.Inclination = 40;
chart1.ChartAreas["Default"].Area3DStyle.Rotation = 20;
chart1.ChartAreas["Default"].Area3DStyle.LightStyle = LightStyle.Realistic;
// Populate series with random data
Random random = new Random();
for (int pointIndex = 0; pointIndex < 10; pointIndex++)
{
chart1.Series["Series1"].Points.AddY(random.Next(45, 95));
chart1.Series["Series2"].Points.AddY(random.Next(5, 75));
}
// Set series chart type
chart1.Series["Series1"].ChartType = SeriesChartType.Line;
chart1.Series["Series2"].ChartType = SeriesChartType.Spline;
// Set point labels
chart1.Series["Series1"].IsValueShownAsLabel = true;
chart1.Series["Series2"].IsValueShownAsLabel = true;
// Enable X axis margin
chart1.ChartAreas["Default"].AxisX.IsMarginVisible = true;
// Enable the ShowMarkerLines
chart1.Series["Series1"]["ShowMarkerLines"] = "true";
chart1.Series["Series2"]["ShowMarkerLines"] = "true";
}
private void TxGraph_Load(object sender, EventArgs e)
{
}
private void Tx_graph_Click(object sender, EventArgs e)
{
}
private void Visualisation_Load(object sender, EventArgs e)
{
}
private void chart11_Click(object sender, EventArgs e)
{
}
}
}
[在什麼情況下我想補充「緊急」或其他類似的詞組我問題,爲了獲得更快的答案?](// meta.stackoverflow.com/q/326569) – 4castle
這個項目的最後期限是3天,所以我需要在這個問題上得到一些進展,讓它準時 –
請閱讀我鏈接到的帖子。 TLDR;需要快速回答的問題往往是低質量的問題,這些問題會吸引低質量的答案。如果你閱讀[問],你和社區都會受益。 – 4castle