Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw coordinate diagrams based on excel data in C #

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of C# how to draw coordinate charts according to excel data, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to draw coordinate charts based on excel data. Let's take a look.

The effect is as follows

Interface

Code

Using System;using System.Collections;using System.Collections.Generic;using System.Drawing;using System.Runtime.InteropServices;using System.Windows.Forms;using System.Windows.Forms.DataVisualization.Charting;namespace WindowsFormsApp2 {public partial class Form1: Form {/ / x and y-axis data double [] x = new double [] {0,0,0,0,0,0,0,0,0} Double [] y = new double [] {0,0,0,0,0,0,0,0,0,0,0,0}; List xList = new List (); List yList = new List (); public Form1 () {InitializeComponent ();} private void button1_Click (object sender, EventArgs e) {string fname = "" OpenFileDialog fdlg = new OpenFileDialog (); fdlg.Title = "Excel FileDialog"; fdlg.InitialDirectory = @ "c:\"; fdlg.Filter = "All files (*. *) | *. * | All files (*. *) | *. *"; fdlg.FilterIndex = 2; fdlg.RestoreDirectory = true If (fdlg.ShowDialog () = = DialogResult.OK) {fname = fdlg.FileName;} Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application (); Microsoft.Office.Interop.Excel.Workbook xlWorkbook = xlApp.Workbooks.Open (fname); Microsoft.Office.Interop.Excel._Worksheet xlWorksheet = xlWorkbook.Sheets [1] Microsoft.Office.Interop.Excel.Range xlRange = xlWorksheet.UsedRange; int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; for (int I = 1; I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report