添加项目文件。

This commit is contained in:
akwkevin
2021-07-23 09:42:22 +08:00
commit f25a958797
2798 changed files with 352360 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using LiveCharts;
using LiveCharts.Defaults;
using LiveCharts.Wpf;
namespace Winforms.Cartesian.GanttChart
{
public partial class GanttExample : Form
{
private ChartValues<GanttPoint> _values;
public GanttExample()
{
InitializeComponent();
var now = System.DateTime.Now;
_values = new ChartValues<GanttPoint>
{
new GanttPoint(now.Ticks, now.AddDays(2).Ticks),
new GanttPoint(now.AddDays(1).Ticks, now.AddDays(3).Ticks),
new GanttPoint(now.AddDays(3).Ticks, now.AddDays(5).Ticks),
new GanttPoint(now.AddDays(5).Ticks, now.AddDays(8).Ticks),
new GanttPoint(now.AddDays(6).Ticks, now.AddDays(10).Ticks),
new GanttPoint(now.AddDays(7).Ticks, now.AddDays(14).Ticks),
new GanttPoint(now.AddDays(9).Ticks, now.AddDays(12).Ticks),
new GanttPoint(now.AddDays(9).Ticks, now.AddDays(14).Ticks),
new GanttPoint(now.AddDays(10).Ticks, now.AddDays(11).Ticks),
new GanttPoint(now.AddDays(12).Ticks, now.AddDays(16).Ticks),
new GanttPoint(now.AddDays(15).Ticks, now.AddDays(17).Ticks),
new GanttPoint(now.AddDays(18).Ticks, now.AddDays(19).Ticks)
};
cartesianChart1.Zoom = ZoomingOptions.X;
cartesianChart1.Series = new SeriesCollection
{
new RowSeries
{
Values = _values,
DataLabels = true
}
};
cartesianChart1.AxisX.Add(new Axis
{
LabelFormatter = value => new System.DateTime((long)value).ToString("dd MMM")
});
var labels = new List<string>();
for (var i = 0; i < 12; i++)
labels.Add("Task " + i);
cartesianChart1.AxisY.Add(new Axis
{
Labels = labels.ToArray()
});
button1_Click(null, null);
}
private void button1_Click(object sender, EventArgs e)
{
cartesianChart1.AxisX[0].MinValue = _values.First().StartPoint;
cartesianChart1.AxisX[0].MaxValue = _values.Last().EndPoint;
}
}
}