怎样标定X和Y轴的分度值,具体的代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataDepict
{
public class DescribeProperties
{
public float move = 10f;
public float newX = 1000f;
public float newY = 400F;
private PointF[] pointList;
int Row = 20;
int colums = 80;
float interval = 10f;
Graphics g;
Bitmap bmp = new Bitmap(1000,400);//画布大小
//Graphics graphics = Graphics.FromImage(bmp);
public void DrawXYAxis(Graphics g)
{
//绘制X轴,
PointF px1 = new PointF(move, 200f);
PointF px2 = new PointF(newX, 200f);
g.DrawLine(new Pen(Brushes.Black, 2), px1, px2);
for (int i = 0; i < Row; i++)
{
g.DrawLine(new Pen(Color.Black,0.5f), new PointF(move, (newY/2) + i * interval), new PointF(1000f, (newY/2) + i * interval));
g.DrawLine(new Pen(Color.Black,0.5f), new PointF(move, (newY / 2) - i * interval), new PointF(1000f, (newY / 2) - i * interval));
//coordinatesLinePen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;//定义线尾的样式为箭头
//g.DrawLine(new Pen(Color.Black), (i + 1) * 1000 / Row, move, (i + 1) * 1000 / Row, 400);
}
//绘制Y轴
PointF py1 = new PointF(move, move);
PointF py2 = new PointF(move, newY);
g.DrawLine(new Pen(Brushes.Black, 2), py1, py2);
for (int i = 0; i < colums; i++)
{
g.DrawLine(new Pen(Color.Black,0.5f), new PointF(move + i * interval, move), new PointF(move + i * interval, newY + i * interval));
//g.DrawLine(new Pen(Color.Black), move, (i + 1) * 400 / colums, 1000, (i + 1) * 400 / colums);
}
}