Commit 6cd247b4 authored by hhchaos's avatar hhchaos

添加项目文件。

parent 7d4f5fd3
Pipeline #156 canceled with stages
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Geometry;
namespace ChartCreator.Chart
{
public class AxisGeometry:IDisposable
{
public CanvasGeometry AxisLine { get; set; }
public CanvasGeometry AxisArrow { get; set; }
public ICanvasImage AxisValueMarker { get; set; }
public Rect DataRect { get; set; }
public void Dispose()
{
AxisLine?.Dispose();
AxisArrow?.Dispose();
AxisValueMarker?.Dispose();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.Imaging;
using Windows.UI;
using ChartCreator.Chart.Style;
using ChartCreator.Chart.Utilities;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Geometry;
namespace ChartCreator.Chart
{
public class BarChart : Chart
{
public BarChart() : base(ChartType.Bar)
{
}
public static List<BarGroupGeometry> GetBarChart(ICanvasResourceCreator resourceCreator,
List<float[]> valuesList, float height, float barWidth, float barBorderWidth,
float barGap, float groupGap, ChartTextFormat dataLabelFormat)
{
var geoList = new List<BarGroupGeometry>();
var max = valuesList.Select(o => o.Max()).Max();
var barNum = valuesList.Count;
var totalGroupGap = (barWidth + barBorderWidth + barGap) * barNum + groupGap - barGap;
var offset = 0f;
foreach (var list in valuesList)
{
var builder = new CanvasPathBuilder(resourceCreator);
var heightList = list.Select(o => (float) (o / max * height)).ToArray();
var startPoint = new Vector2();
var markerPoints = new List<Vector2>();
var markerStrs = new List<string>();
for (int i = 0; i < heightList.Count(); i++)
{
builder.BeginFigure(startPoint);
builder.AddLine(new Vector2(startPoint.X, startPoint.Y - heightList[i]));
builder.AddLine(new Vector2(startPoint.X + barWidth, startPoint.Y - heightList[i]));
builder.AddLine(new Vector2(startPoint.X + barWidth, startPoint.Y));
builder.EndFigure(CanvasFigureLoop.Open);
var markerPoint = new Vector2(startPoint.X + barWidth / 2, startPoint.Y - heightList[i]);
markerPoints.Add(markerPoint);
markerStrs.Add($"{list[i]}");
startPoint = new Vector2(startPoint.X + totalGroupGap, startPoint.Y);
}
geoList.Add(new BarGroupGeometry
{
ShapeGeometry = CanvasGeometry.CreatePath(builder),
DataLabels = ChartDrawHelper.CreateValueMarker(resourceCreator, dataLabelFormat, markerPoints,
markerStrs,
MarkerPosition.Bottom),
Offset = offset
});
builder.Dispose();
offset += barGap + barWidth + barBorderWidth;
}
return geoList;
}
public override CanvasCommandList GetChartImage()
{
if (Values == null || Values.GroupCount == 0 ||
Style?.ChartType != ChartType.Bar)
{
return null;
}
var style = (BarChartStyle) Style;
var colorSpace = Style.ColorSpace.Select(ColorConverter.ConvertHexToColor).ToList();
var device = CanvasDevice.GetSharedDevice();
var commandList = new CanvasCommandList(device);
using (var session = commandList.CreateDrawingSession())
{
var titleLayout = ChartDrawHelper.CreateCanvasText(device, Values.Title, style.TitleFormat);
var titleRect = titleLayout.LayoutBounds;
if (Values.IsShowTitle)
session.DrawTextLayout(titleLayout, new Vector2(),
ColorConverter.ConvertHexToColor(style.TitleFormat.Foreground));
titleLayout.Dispose();
var barWidth = style.BarMaxNumber > 1
? style.BarMaxWidth - (style.BarMaxWidth - style.BarMinWidth) / (style.BarMaxNumber - 1) *
(Values.LegendItemCount - 1)
: style.BarMaxWidth;
var groupLength = (barWidth + style.BarBorderWidth + style.BarSpace) * Values.LegendItemCount +
style.GroupSpace - style.BarSpace;
var totalWidth = Values.GroupCount * groupLength - style.GroupSpace;
var maxValue = Values.Data.Select(o => o.Max()).Max();
var maxMarkerValue = (float) ValueFormatHelper.Ceiling(maxValue, 2);
var axisGeo = ChartDrawHelper.GetAxis(device, style.AxisStyle, totalWidth, maxMarkerValue);
var axisRect = axisGeo.AxisLine.ComputeBounds();
axisRect.Union(axisGeo.AxisValueMarker.GetBounds(device));
var axisOffset =
new Point((titleRect.Width - axisRect.Width) / 2 - axisRect.X,
titleRect.Height + style.TitleFormat.Thickness.Bottom - axisRect.Y).ToVector2();
using (var axisCommandList = new CanvasCommandList(session))
{
using (var axisDrawSession = axisCommandList.CreateDrawingSession())
{
axisDrawSession.Transform = Matrix3x2.CreateTranslation(axisOffset);
axisDrawSession.DrawGeometry(axisGeo.AxisLine,
ColorConverter.ConvertHexToColor(style.AxisStyle.LineColor), style.AxisStyle.LineWidth);
axisDrawSession.FillGeometry(axisGeo.AxisArrow,
ColorConverter.ConvertHexToColor(style.AxisStyle.LineColor));
axisDrawSession.DrawImage(axisGeo.AxisValueMarker);
}
session.DrawImage(axisCommandList);
}
axisGeo.Dispose();
var maxValueHeight = maxValue / maxMarkerValue * axisGeo.DataRect.Height;
var barGroupGeos = GetBarChart(device, Values.Data, (float) maxValueHeight, barWidth,
style.BarBorderWidth,
style.BarSpace, style.GroupSpace, style.DataLabelFormat);
var dataOffset = axisOffset +
new Point(axisGeo.DataRect.X, axisGeo.DataRect.Y + axisGeo.DataRect.Height)
.ToVector2();
using (var dataCommandList = new CanvasCommandList(session))
{
using (var drawSession = dataCommandList.CreateDrawingSession())
{
drawSession.Transform = Matrix3x2.CreateTranslation(dataOffset);
for (int i = 0; i < barGroupGeos.Count; i++)
{
drawSession.FillGeometry(barGroupGeos[i].ShapeGeometry,
new Vector2(barGroupGeos[i].Offset, 0),
colorSpace[i % colorSpace.Count]);
drawSession.DrawGeometry(barGroupGeos[i].ShapeGeometry,
new Vector2(barGroupGeos[i].Offset, 0),
ColorConverter.ConvertHexToColor(style.BarBorderColor), style.BarBorderWidth);
if (Values.IsShowDataValues)
drawSession.DrawImage(barGroupGeos[i].DataLabels,
new Vector2(barGroupGeos[i].Offset, 0));
barGroupGeos[i].Dispose();
}
}
session.DrawImage(dataCommandList);
}
if (Values.IsShowGroupLabels)
{
var markerPoints = new List<Vector2>();
var markerStrs = new List<string>();
for (int i = 0; i < Values.GroupCount; i++)
{
var markerPoint = new Vector2(i * groupLength, 0);
markerPoints.Add(markerPoint);
markerStrs.Add(Values.GroupLabels[i]);
}
var groupLabels = ChartDrawHelper.CreateValueMarker(device, style.GroupLabelFormat, markerPoints,
markerStrs,
MarkerPosition.Bottom);
var groupLabelsOffset = axisOffset +
new Vector2(
style.AxisStyle.StartOffset + (groupLength - style.GroupSpace) / 2, 0);
using (var dataCommandList = new CanvasCommandList(session))
{
using (var drawSession = dataCommandList.CreateDrawingSession())
{
drawSession.Transform = Matrix3x2.CreateTranslation(groupLabelsOffset);
drawSession.DrawImage(groupLabels);
}
session.DrawImage(dataCommandList);
}
groupLabels.Dispose();
}
if (Values.IsShowLegend)
{
var legendLabels = Values.LegendItemLabels.Take(Values.LegendItemCount).ToList();
var legend = ChartDrawHelper.CreateLegend(device, style.LegendStyle,
legendLabels, colorSpace, Values.LegendPosition);
var legendRect = legend.GetBounds(device);
switch (Values.LegendPosition)
{
case LegendPosition.Right:
var rightOffset =
new Point(
axisOffset.X + axisRect.Width + style.LegendStyle.Thickness.Left - legendRect.X,
axisOffset.Y - legendRect.Height - legendRect.Y)
.ToVector2();
session.DrawImage(legend, rightOffset);
break;
case LegendPosition.Bottom:
var bottomOffset =
new Point(
(titleRect.Width - legendRect.Width) / 2 - legendRect.X,
axisOffset.Y + style.LegendStyle.Thickness.Top - legendRect.Y)
.ToVector2();
session.DrawImage(legend, bottomOffset);
break;
}
legend.Dispose();
}
return commandList;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Geometry;
namespace ChartCreator.Chart
{
public class BarGroupGeometry : IDisposable
{
public CanvasGeometry ShapeGeometry { get; set; }
public ICanvasImage DataLabels { get; set; }
public float Offset { get; set; }
public void Dispose()
{
ShapeGeometry?.Dispose();
DataLabels?.Dispose();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.Imaging;
using ChartCreator.Chart.Style;
using Microsoft.Graphics.Canvas;
namespace ChartCreator.Chart
{
public abstract class Chart
{
protected Chart(ChartType chartType)
{
ChartType = chartType;
}
public ChartType ChartType { get; }
public ChartValues Values { get; set; }
public ChartStyle Style { get; set; }
public abstract CanvasCommandList GetChartImage();
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChartCreator.Chart
{
public enum ChartType
{
Bar,
Pie,
Line
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ChartCreator.Chart.Style;
using Newtonsoft.Json;
namespace ChartCreator.Chart
{
public class ChartValues
{
[JsonProperty("title")]
public string Title { get; set; }
/// <summary>
/// 组标签集合
/// </summary>
[JsonProperty("groupLabels")]
public List<string> GroupLabels { get; set; }
/// <summary>
/// 系列标签集合
/// </summary>
[JsonProperty("legendItemLabels")]
public List<string> LegendItemLabels { get; set; }
/// <summary>
/// 系列数据列表(每系列为一组)
/// </summary>
[JsonProperty("data")]
public List<float[]> Data { get; set; }
[JsonProperty("legendPosition")]
public LegendPosition LegendPosition { get; set; }
[JsonProperty("isShowTitle")]
public bool IsShowTitle { get; set; }
[JsonProperty("isShowGroupLabels")]
public bool IsShowGroupLabels { get; set; }
[JsonProperty("isShowLegend")]
public bool IsShowLegend { get; set; }
[JsonProperty("isShowDataValues")]
public bool IsShowDataValues { get; set; }
[JsonIgnore]
public int LegendItemCount => Data?.Count ?? 0;
[JsonIgnore]
public int GroupCount
{
get
{
if (Data?.Count > 0)
{
return Data[0]?.Length ?? 0;
}
return 0;
}
}
}
}
namespace ChartCreator.Chart
{
public enum LegendPosition
{
Right,
Bottom
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.Imaging;
using Windows.UI;
using ChartCreator.Chart.Style;
using ChartCreator.Chart.Utilities;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Geometry;
namespace ChartCreator.Chart
{
public class LineChart : Chart
{
public LineChart() : base(ChartType.Line)
{
}
public static List<PolyLineGeometry> GetLineChart(ICanvasResourceCreator resourceCreator, LineChartStyle style,
List<float[]> valuesList, float height, float width, ChartTextFormat dataLabelFormat,
List<string> colorSpace)
{
var geoList = new List<PolyLineGeometry>();
var max = valuesList.Select(o => o.Max()).Max();
var pointNum = valuesList[0].Length;
var pointGap = width / (pointNum - 1);
for (int i = 0; i < valuesList.Count; i++)
{
var list = valuesList[i];
var markerPoints = new List<Vector2>();
var markerStrs = new List<string>();
var dotList = new List<CanvasGeometry>();
var builder = new CanvasPathBuilder(resourceCreator);
var heightList = list.Select(o => (float) (o / max * height)).ToList();
var offset = 0f;
var first = heightList.First();
var startPoint = new Vector2(offset, -first);
builder.BeginFigure(startPoint);
dotList.Add(GetDotGeometry(resourceCreator, style.DotShape, startPoint, style.DotSizeWidth,
style.DotSizeHeight));
markerPoints.Add(startPoint);
markerStrs.Add($"{list[0]}");
heightList.Remove(first);
for (int j = 0; j < heightList.Count; j++)
{
offset += pointGap;
var point = new Vector2(offset, -heightList[j]);
builder.AddLine(point);
dotList.Add(GetDotGeometry(resourceCreator, style.DotShape, point, style.DotSizeWidth,
style.DotSizeHeight));
markerPoints.Add(point);
markerStrs.Add($"{list[j + 1]}");
}
builder.EndFigure(CanvasFigureLoop.Open);
var format = dataLabelFormat.Clone();
//format.Foreground = colorSpace[i % colorSpace.Count];
format.Thickness = new ChartThickness(0, format.Thickness.Top + style.DotSizeHeight / 2, 0, 0);
var polyLineGeometry = new PolyLineGeometry
{
LineGeometry = CanvasGeometry.CreatePath(builder),
DotGeometries = dotList,
DataLabels = ChartDrawHelper.CreateValueMarker(resourceCreator, format, markerPoints,
markerStrs,
MarkerPosition.Bottom),
};
geoList.Add(polyLineGeometry);
}
return geoList;
}
public static CanvasGeometry GetDotGeometry(ICanvasResourceCreator resourceCreator, DotShape shape,
Vector2 point, float dotWidth, float dotHeight)
{
return CanvasGeometry.CreateCircle(resourceCreator, point, dotWidth / 2);
}
public override CanvasCommandList GetChartImage()
{
if (Values == null || Values.GroupCount == 0 ||
Style?.ChartType != ChartType.Line)
{
return null;
}
var style = (LineChartStyle) Style;
var colorSpace = Style.ColorSpace.Select(ColorConverter.ConvertHexToColor).ToList();
var device = CanvasDevice.GetSharedDevice();
var commandList = new CanvasCommandList(device);
using (var session = commandList.CreateDrawingSession())
{
var titleLayout = ChartDrawHelper.CreateCanvasText(device, Values.Title, style.TitleFormat);
var titleRect = titleLayout.LayoutBounds;
if (Values.IsShowTitle)
session.DrawTextLayout(titleLayout, new Vector2(),
ColorConverter.ConvertHexToColor(style.TitleFormat.Foreground));
titleLayout.Dispose();
var maxValue = Values.Data.Select(o => o.Max()).Max();
var maxMarkerValue = (float) ValueFormatHelper.Ceiling(maxValue, 2);
var axisGeo = ChartDrawHelper.GetAxis(device, style.AxisStyle, style.DataAreaWidth, maxMarkerValue);
var axisRect = axisGeo.AxisLine.ComputeBounds();
axisRect.Union(axisGeo.AxisValueMarker.GetBounds(device));
var axisOffset =
new Point((titleRect.Width - axisRect.Width) / 2 - axisRect.X,
titleRect.Height + style.TitleFormat.Thickness.Bottom - axisRect.Y).ToVector2();
using (var axisCommandList = new CanvasCommandList(session))
{
using (var axisDrawSession = axisCommandList.CreateDrawingSession())
{
axisDrawSession.Transform = Matrix3x2.CreateTranslation(axisOffset);
axisDrawSession.DrawGeometry(axisGeo.AxisLine,
ColorConverter.ConvertHexToColor(style.AxisStyle.LineColor), style.AxisStyle.LineWidth);
axisDrawSession.FillGeometry(axisGeo.AxisArrow,
ColorConverter.ConvertHexToColor(style.AxisStyle.LineColor));
axisDrawSession.DrawImage(axisGeo.AxisValueMarker);
}
session.DrawImage(axisCommandList);
}
axisGeo.Dispose();
var maxValueHeight = maxValue / maxMarkerValue * axisGeo.DataRect.Height;
var lineGeos = GetLineChart(device, style, Values.Data, (float) maxValueHeight, style.DataAreaWidth,
style.DataLabelFormat, Style.ColorSpace);
var dataOffset = axisOffset +
new Point(axisGeo.DataRect.X, axisGeo.DataRect.Y + axisGeo.DataRect.Height)
.ToVector2();
using (var dataCommandList = new CanvasCommandList(session))
{
using (var drawSession = dataCommandList.CreateDrawingSession())
{
drawSession.Transform = Matrix3x2.CreateTranslation(dataOffset);
for (int i = 0; i < lineGeos.Count; i++)
{
drawSession.DrawGeometry(lineGeos[i].LineGeometry, colorSpace[i % colorSpace.Count],
style.LineWidth);
foreach (var dot in lineGeos[i].DotGeometries)
{
drawSession.FillGeometry(dot, colorSpace[i % colorSpace.Count]);
}
if (Values.IsShowDataValues)
drawSession.DrawImage(lineGeos[i].DataLabels);
lineGeos[i].Dispose();
}
}
session.DrawImage(dataCommandList);
}
if (Values.IsShowGroupLabels)
{
var markerPoints = new List<Vector2>();
var markerStrs = new List<string>();
var groupLength = style.DataAreaWidth / (Values.GroupCount - 1);
for (int i = 0; i < Values.GroupCount; i++)
{
var markerPoint = new Vector2(i * groupLength, 0);
markerPoints.Add(markerPoint);
markerStrs.Add(Values.GroupLabels[i]);
}
var groupLabels = ChartDrawHelper.CreateValueMarker(device, style.GroupLabelFormat, markerPoints,
markerStrs,
MarkerPosition.Bottom);
var groupLabelsOffset = axisOffset +
new Vector2(
style.AxisStyle.StartOffset, 0);
using (var dataCommandList = new CanvasCommandList(session))
{
using (var drawSession = dataCommandList.CreateDrawingSession())
{
drawSession.Transform = Matrix3x2.CreateTranslation(groupLabelsOffset);
drawSession.DrawImage(groupLabels);
}
session.DrawImage(dataCommandList);
}
groupLabels.Dispose();
}
if (Values.IsShowLegend)
{
var legendLabels = Values.LegendItemLabels.Take(Values.LegendItemCount).ToList();
var legend = ChartDrawHelper.CreateLegend(device, style.LegendStyle,
legendLabels, colorSpace, Values.LegendPosition);
var legendRect = legend.GetBounds(device);
switch (Values.LegendPosition)
{
case LegendPosition.Right:
var rightOffset =
new Point(
axisOffset.X + axisRect.Width + style.LegendStyle.Thickness.Left - legendRect.X,
axisOffset.Y - legendRect.Height - legendRect.Y)
.ToVector2();
session.DrawImage(legend, rightOffset);
break;
case LegendPosition.Bottom:
var bottomOffset =
new Point(
(titleRect.Width - legendRect.Width) / 2 - legendRect.X,
axisOffset.Y + style.LegendStyle.Thickness.Top - legendRect.Y)
.ToVector2();
session.DrawImage(legend, bottomOffset);
break;
}
legend.Dispose();
}
return commandList;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChartCreator.Chart
{
public enum MarkerPosition
{
Top,
Right,
Bottom,
Left
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.Imaging;
using Windows.UI;
using Windows.UI.Xaml.Media.Imaging;
using ChartCreator.Chart.Style;
using ChartCreator.Chart.Utilities;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.Graphics.Canvas.Text;
namespace ChartCreator.Chart
{
public class PieChart : Chart
{
public PieChart() : base(ChartType.Pie)
{
}
public static List<PiePartGeometry> GetPieChart(ICanvasResourceCreator resourceCreator,
float[] valueList, ChartTextFormat textFormat, float radius, bool isShowData)
{
var centerPoint = new Vector2(radius, radius);
var geoList = new List<PiePartGeometry>();
var sum = valueList.Sum();
var startAngle = 0f;
var percentList = valueList.Select(o => o / sum);
foreach (var item in percentList)
{
var radian = item * 2 * Math.PI;
var builder = new CanvasPathBuilder(resourceCreator);
builder.BeginFigure(centerPoint);
builder.AddArc(centerPoint, radius, radius, startAngle, (float) radian);
builder.EndFigure(CanvasFigureLoop.Closed);
if (isShowData)
{
var partCenter = new Point(
(radius - textFormat.Thickness.Top) * Math.Cos(startAngle + radian / 2) + centerPoint.X,
(radius - textFormat.Thickness.Top) * Math.Sin(startAngle + radian / 2) + centerPoint.Y)
.ToVector2();
var textLayout = ChartDrawHelper.CreateCanvasText(resourceCreator,
$"{string.Format("{0:F1}", item * 100)}%", textFormat);
var textRect = textLayout.DrawBounds;
var textPos = new Point(partCenter.X - textRect.Width / 2, partCenter.Y - textRect.Height / 2);
var part = new PiePartGeometry
{
ShapeGeometry = CanvasGeometry.CreatePath(builder),
TextGeometry = CanvasGeometry.CreateText(textLayout),
DataRect = new Rect(textPos, new Size(textRect.Width, textRect.Height))
};
geoList.Add(part);
builder.Dispose();
textLayout.Dispose();
}
else
{
var part = new PiePartGeometry
{
ShapeGeometry = CanvasGeometry.CreatePath(builder)
};
geoList.Add(part);
builder.Dispose();
}
startAngle += (float) radian;
}
return geoList;
}
public override CanvasCommandList GetChartImage()
{
if (Values == null || Values.GroupCount == 0 ||
Style?.ChartType != ChartType.Pie)
{
return null;
}
var style = (PieChartStyle) Style;
var colorSpace = Style.ColorSpace.Select(ColorConverter.ConvertHexToColor).ToList();
var device = CanvasDevice.GetSharedDevice();
var commandList = new CanvasCommandList(device);
using (var session = commandList.CreateDrawingSession())
{
var geos = GetPieChart(device, Values.Data[0], style.DataLabelFormat, style.Radius,
Values.IsShowDataValues);
var titleLayout = ChartDrawHelper.CreateCanvasText(device, Values.Title, style.TitleFormat);
var titleRect = titleLayout.LayoutBounds;
if (Values.IsShowTitle)
session.DrawTextLayout(titleLayout, new Vector2(),
ColorConverter.ConvertHexToColor(style.TitleFormat.Foreground));
titleLayout.Dispose();
var diameter = style.Radius * 2 + style.BorderWidth/2;
var pieOffset =
new Point((titleRect.Width - diameter) / 2,
titleRect.Height + style.TitleFormat.Thickness.Bottom).ToVector2();
using (var pieCommandList = new CanvasCommandList(session))
{
using (var pieDrawSession = pieCommandList.CreateDrawingSession())
{
pieDrawSession.Transform = Matrix3x2.CreateTranslation(pieOffset);
for (int i = 0; i < geos.Count; i++)
{
pieDrawSession.FillGeometry(geos[i].ShapeGeometry,
colorSpace[i % Style.ColorSpace.Count]);
}
foreach (var t in geos)
{
pieDrawSession.DrawGeometry(t.ShapeGeometry,
ColorConverter.ConvertHexToColor(style.BorderColor), style.BorderWidth,
new CanvasStrokeStyle
{
LineJoin = CanvasLineJoin.Round,
});
if (Values.IsShowDataValues)
pieDrawSession.FillGeometry(t.TextGeometry, (float) t.DataRect.X,
(float) t.DataRect.Y,
ColorConverter.ConvertHexToColor(style.DataLabelFormat.Foreground));
t.Dispose();
}
}
session.DrawImage(pieCommandList);
}
if (Values.IsShowLegend)
{
var legendLabels = Values.GroupLabels.Take(Values.GroupCount).ToList();
var legend = ChartDrawHelper.CreateLegend(device, style.LegendStyle,
legendLabels, colorSpace, Values.LegendPosition);
var legendRect = legend.GetBounds(device);
switch (Values.LegendPosition)
{
case LegendPosition.Right:
var rightOffset =
new Point(
pieOffset.X + diameter + style.LegendStyle.Thickness.Left - legendRect.X,
pieOffset.Y + (diameter - legendRect.Height) - legendRect.Y)
.ToVector2();
session.DrawImage(legend, rightOffset);
break;
case LegendPosition.Bottom:
var bottomOffset =
new Point(
(titleRect.Width - legendRect.Width) / 2 - legendRect.X,
titleRect.Height + style.TitleFormat.Thickness.Bottom +
diameter + style.LegendStyle.Thickness.Top - legendRect.Y)
.ToVector2();
session.DrawImage(legend, bottomOffset);
break;
}
legend.Dispose();
}
}
return commandList;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Microsoft.Graphics.Canvas.Geometry;
namespace ChartCreator.Chart
{
public class PiePartGeometry:IDisposable
{
public CanvasGeometry ShapeGeometry { get; set; }
public CanvasGeometry TextGeometry { get; set; }
public Rect DataRect { get; set; }
public void Dispose()
{
ShapeGeometry?.Dispose();
TextGeometry?.Dispose();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Geometry;
namespace ChartCreator.Chart
{
public class PolyLineGeometry : IDisposable
{
public CanvasGeometry LineGeometry { get; set; }
public List<CanvasGeometry> DotGeometries { get; set; }
public ICanvasImage DataLabels { get; set; }
public void Dispose()
{
LineGeometry?.Dispose();
DataLabels?.Dispose();
if (DotGeometries?.Count > 0)
DotGeometries.ForEach(o => o?.Dispose());
}
}
}
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public class AxisStyle
{
[JsonProperty("valueMarkerFormat")]
public ChartTextFormat ValueMarkerFormat { get; set; }
[JsonProperty("valueMarkerLineLength")]
public float ValueMarkerLineLength { get; set; }
[JsonProperty("lineWidth")]
public float LineWidth { get; set; }
[JsonProperty("lineColor")]
public string LineColor { get; set; }
[JsonProperty("dataAreaHeight")]
public float DataAreaHeight { get; set; }
/// <summary>
/// 纵轴最大值到上箭头距离
/// </summary>
[JsonProperty("topSpace")]
public float TopSpace { get; set; }
/// <summary>
/// 横轴最后一个值横坐标到右箭头距离
/// </summary>
[JsonProperty("rightSpace")]
public float RightSpace { get; set; }
/// <summary>
/// 原点到数据区的距离
/// </summary>
[JsonProperty("startOffset")]
public float StartOffset { get; set; }
[JsonProperty("arrowWidth")]
public float ArrowWidth { get; set; }
[JsonProperty("arrowHeight")]
public float ArrowHeight { get; set; }
}
}
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public class BarChartStyle: ChartStyle
{
public BarChartStyle()
{
ChartType = ChartType.Bar;
}
[JsonProperty("axisStyle")]
public AxisStyle AxisStyle { get; set; }
[JsonProperty("groupLabelFormat")]
public ChartTextFormat GroupLabelFormat { get; set; }
[JsonProperty("barBorderWidth")]
public float BarBorderWidth { get; set; }
[JsonProperty("barBorderColor")]
public string BarBorderColor { get; set; }
[JsonProperty("barMaxWidth")]
public float BarMaxWidth { get; set; }
[JsonProperty("barMinWidth")]
public float BarMinWidth { get; set; }
[JsonProperty("barMaxNumber")]
public int BarMaxNumber { get; set; }
/// <summary>
/// 组间距
/// </summary>
[JsonProperty("groupSpace")]
public float GroupSpace { get; set; }
/// <summary>
/// 柱间距
/// </summary>
[JsonProperty("barSpace")]
public float BarSpace { get; set; }
}
}
using System.Collections.Generic;
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public abstract class ChartStyle
{
[JsonProperty("chartType")]
public ChartType ChartType { get;internal set; }
[JsonProperty("titleFormat")]
public ChartTextFormat TitleFormat { get; set; }
[JsonProperty("dataLabelFormat")]
public ChartTextFormat DataLabelFormat { get; set; }
[JsonProperty("legendStyle")]
public LegendStyle LegendStyle { get; set; }
[JsonProperty("colorSpace")]
public List<string> ColorSpace { get; set; }
}
}
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public sealed class ChartTextFormat
{
[JsonProperty("fontFamily")]
public string FontFamily { get; set; }
[JsonProperty("fontSize")]
public float FontSize { get; set; }
[JsonProperty("foreground")]
public string Foreground { get; set; }
//bold相当于字重为700,nomal相当于字重为400
[JsonProperty("isBold")]
public bool IsBold { get; set; }
[JsonProperty("thickness")]
public ChartThickness Thickness { get; set; }
public ChartTextFormat Clone()
{
return new ChartTextFormat
{
FontFamily = FontFamily,
FontSize = FontSize,
Foreground = Foreground,
IsBold = IsBold,
Thickness = Thickness
};
}
}
}
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public class ChartThickness
{
public ChartThickness(float left, float top, float right, float bottom)
{
Left = left;
Top = top;
Right = right;
Bottom = bottom;
}
[JsonProperty("left")]
public float Left { get; set; }
[JsonProperty("top")]
public float Top { get; set; }
[JsonProperty("right")]
public float Right { get; set; }
[JsonProperty("bottom")]
public float Bottom { get; set; }
}
}
namespace ChartCreator.Chart.Style
{
public enum DotShape
{
Circle,
Triangle,
Square
}
}
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public class LegendStyle
{
[JsonProperty("colorBlockWidth")]
public float ColorBlockWidth { get; set; }
[JsonProperty("colorBlockHeight")]
public float ColorBlockHeight { get; set; }
[JsonProperty("labelFormat")]
public ChartTextFormat LabelFormat { get; set; }
[JsonProperty("thickness")]
public ChartThickness Thickness { get; set; }
}
}
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public class LineChartStyle : ChartStyle
{
public LineChartStyle()
{
ChartType = ChartType.Line;
}
[JsonProperty("axisStyle")]
public AxisStyle AxisStyle { get; set; }
[JsonProperty("groupLabelFormat")]
public ChartTextFormat GroupLabelFormat { get; set; }
[JsonProperty("dataAreaWidth")]
public float DataAreaWidth { get; set; }
[JsonProperty("lineWidth")]
public float LineWidth { get; set; }
[JsonProperty("dotSizeWidth")]
public float DotSizeWidth { get; set; }
[JsonProperty("dotSizeHeight")]
public float DotSizeHeight { get; set; }
[JsonProperty("dotShape")]
public DotShape DotShape { get; set; }
}
}
using Newtonsoft.Json;
namespace ChartCreator.Chart.Style
{
public class PieChartStyle : ChartStyle
{
public PieChartStyle()
{
ChartType = ChartType.Pie;
}
[JsonProperty("radius")]
public float Radius { get; set; }
[JsonProperty("borderWidth")]
public float BorderWidth { get; set; }
[JsonProperty("borderColor")]
public string BorderColor { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.Imaging;
using Windows.UI;
using ChartCreator.Chart.Style;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Geometry;
using Microsoft.Graphics.Canvas.Text;
namespace ChartCreator.Chart.Utilities
{
public static class ChartDrawHelper
{
public static CanvasBitmap GetCanvasBitmap(this CanvasCommandList canvasCommandList)
{
var chartRect = canvasCommandList.GetBounds(canvasCommandList.Device);
var offScreen = new CanvasRenderTarget(canvasCommandList.Device, (float) chartRect.Width,
(float) chartRect.Height, 96);
var chartOffset = new Point(-chartRect.X, -chartRect.Y).ToVector2();
using (var session = offScreen.CreateDrawingSession())
{
session.Transform = Matrix3x2.CreateTranslation(chartOffset);
session.DrawImage(canvasCommandList);
}
return offScreen;
}
public static async Task<SoftwareBitmap> GetSoftwareBitmapAsync(this CanvasCommandList canvasCommandList)
{
var offScreen = canvasCommandList.GetCanvasBitmap();
var bitmap = await SoftwareBitmap.CreateCopyFromSurfaceAsync(offScreen, BitmapAlphaMode.Premultiplied);
offScreen.Dispose();
return bitmap;
}
public static AxisGeometry GetAxis(ICanvasResourceCreator resourceCreator, AxisStyle style, float dataWidth,
float maxValue)
{
var totalHeight = style.DataAreaHeight + style.TopSpace + style.ArrowHeight;
var totalWidth = dataWidth + style.RightSpace + style.StartOffset + style.ArrowHeight;
var zeroPoint = new Vector2();
var topPoint = new Vector2(zeroPoint.X, zeroPoint.Y - totalHeight);
var rightPoint = new Vector2(zeroPoint.X + totalWidth, zeroPoint.Y);
//xy轴
var builder = new CanvasPathBuilder(resourceCreator);
builder.BeginFigure(new Vector2(topPoint.X, topPoint.Y + style.ArrowHeight));
builder.AddLine(zeroPoint);
builder.AddLine(new Vector2(rightPoint.X - style.ArrowHeight, rightPoint.Y));
builder.EndFigure(CanvasFigureLoop.Open);
//y轴箭头
var arrowBuilder = new CanvasPathBuilder(resourceCreator);
arrowBuilder.BeginFigure(new Vector2(topPoint.X - style.ArrowWidth / 2, topPoint.Y + style.ArrowHeight));
arrowBuilder.AddLine(topPoint);
arrowBuilder.AddLine(new Vector2(topPoint.X + style.ArrowWidth / 2, topPoint.Y + style.ArrowHeight));
arrowBuilder.EndFigure(CanvasFigureLoop.Open);
//x轴箭头
arrowBuilder.BeginFigure(new Vector2(rightPoint.X - style.ArrowHeight,
rightPoint.Y - style.ArrowWidth / 2));
arrowBuilder.AddLine(rightPoint);
arrowBuilder.AddLine(new Vector2(rightPoint.X - style.ArrowHeight, rightPoint.Y + style.ArrowWidth / 2));
arrowBuilder.EndFigure(CanvasFigureLoop.Open);
var dataLeftTopPoint = new Point(style.StartOffset, -style.DataAreaHeight);
var dataRightBottomPoint = new Point(dataWidth + style.StartOffset, -style.LineWidth/2);
var valueGap = maxValue / 5;
var valueHeightGap = style.DataAreaHeight / 5;
var markerPoints = new List<Vector2>();
var markerStrs = new List<string>();
for (int i = 0; i < 6; i++)
{
var markerPoint = new Vector2(0, -i * valueHeightGap);
markerPoints.Add(markerPoint);
if (i == 5)
{
markerStrs.Add($"{maxValue}");
}
else
{
var value = ValueFormatHelper.Round(i * valueGap, 3);
markerStrs.Add($"{value}");
}
builder.BeginFigure(markerPoint);
builder.AddLine(new Vector2(markerPoint.X + style.ValueMarkerLineLength + style.LineWidth,
markerPoint.Y));
builder.EndFigure(CanvasFigureLoop.Open);
}
var axis = new AxisGeometry
{
AxisLine = CanvasGeometry.CreatePath(builder),
AxisArrow = CanvasGeometry.CreatePath(arrowBuilder),
AxisValueMarker = CreateValueMarker(resourceCreator, style.ValueMarkerFormat, markerPoints, markerStrs,
MarkerPosition.Left),
DataRect = new Rect(dataLeftTopPoint, dataRightBottomPoint)
};
return axis;
}
public static CanvasTextLayout CreateCanvasText(ICanvasResourceCreator resourceCreator, string text,
ChartTextFormat textFormat, float requestedWidth = 0, float requestedHeight = 0)
{
var textLayout = new CanvasTextLayout(resourceCreator, text,
new CanvasTextFormat
{
FontWeight=new Windows.UI.Text.FontWeight
{
Weight=textFormat.IsBold?(ushort)700: (ushort)400
},
FontFamily = textFormat.FontFamily,
FontSize = textFormat.FontSize,
WordWrapping = CanvasWordWrapping.NoWrap,
TrimmingSign = CanvasTrimmingSign.Ellipsis
}, requestedWidth, requestedHeight);
return textLayout;
}
public static ICanvasImage CreateLegend(ICanvasResourceCreator resourceCreator, LegendStyle style,
List<string> serieLabels, List<Color> colorSpace,
LegendPosition legendPosition)
{
if (serieLabels?.Count > 0 && colorSpace?.Count >= serieLabels.Count)
{
var commandList = new CanvasCommandList(resourceCreator);
using (var drawSession = commandList.CreateDrawingSession())
{
var cancasTextArray =
serieLabels.Select(o => CreateCanvasText(resourceCreator, o, style.LabelFormat)).ToArray();
var textRectHeight = cancasTextArray.Select(o => o.DrawBounds.Height).Max();
var groupHeight = (float) Math.Max(textRectHeight, style.ColorBlockHeight);
var colorBlockYOffset = (float) (textRectHeight - style.ColorBlockHeight) / 2;
var startXOffset = 0f;
var startYOffset = colorBlockYOffset;
for (int i = 0; i < serieLabels.Count; i++)
{
drawSession.FillRectangle(startXOffset, startYOffset, style.ColorBlockWidth,
style.ColorBlockHeight, colorSpace[i]);
drawSession.DrawTextLayout(cancasTextArray[i],
startXOffset + style.ColorBlockWidth + style.LabelFormat.Thickness.Left,
startYOffset - colorBlockYOffset - (float) cancasTextArray[i].DrawBounds.Y,
ColorConverter.ConvertHexToColor(style.LabelFormat.Foreground));
if (legendPosition == LegendPosition.Bottom)
{
startXOffset += style.ColorBlockWidth;
startXOffset += style.LabelFormat.Thickness.Left;
startXOffset += (float) cancasTextArray[i].LayoutBounds.Width;
startXOffset += style.LabelFormat.Thickness.Right;
}
else if (legendPosition == LegendPosition.Right)
{
startYOffset += groupHeight;
startYOffset += style.LabelFormat.Thickness.Bottom;
}
cancasTextArray[i].Dispose();
}
}
return commandList;
}
return null;
}
public static ICanvasImage CreateValueMarker(ICanvasResourceCreator resourceCreator,
ChartTextFormat markerFormat, List<Vector2> positions, List<string> labels, MarkerPosition markerPosition)
{
if (positions?.Count > 0 && positions.Count == labels?.Count)
{
var commandList = new CanvasCommandList(resourceCreator);
using (var drawSession = commandList.CreateDrawingSession())
{
var cancasTextArray =
labels.Select(o => CreateCanvasText(resourceCreator, o, markerFormat)).ToArray();
for (int i = 0; i < positions.Count; i++)
{
var textRect = cancasTextArray[i].DrawBounds;
double x = positions[i].X, y = positions[i].Y;
switch (markerPosition)
{
case MarkerPosition.Top:
x -= textRect.Width / 2 + textRect.X;
y -= textRect.Height + textRect.Y + markerFormat.Thickness.Bottom;
break;
case MarkerPosition.Right:
x += markerFormat.Thickness.Left - textRect.X;
y -= textRect.Height / 2 + textRect.Y;
break;
case MarkerPosition.Bottom:
x -= textRect.Width / 2 + textRect.X;
y += -textRect.Y + markerFormat.Thickness.Top;
break;
case MarkerPosition.Left:
x -= textRect.Width + markerFormat.Thickness.Right - textRect.X;
y -= textRect.Height / 2 + textRect.Y;
break;
}
drawSession.DrawTextLayout(cancasTextArray[i], (float) x, (float) y,
ColorConverter.ConvertHexToColor(markerFormat.Foreground));
cancasTextArray[i].Dispose();
}
}
return commandList;
}
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
namespace ChartCreator.Chart.Utilities
{
public static class ColorConverter
{
public static Color ConvertHexToColor(string hex)
{
hex = hex.Remove(0, 1);
byte a = hex.Length == 8 ? Byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber) : (byte)255;
byte r = Byte.Parse(hex.Substring(hex.Length - 6, 2), NumberStyles.HexNumber);
byte g = Byte.Parse(hex.Substring(hex.Length - 4, 2), NumberStyles.HexNumber);
byte b = Byte.Parse(hex.Substring(hex.Length - 2), NumberStyles.HexNumber);
return Color.FromArgb(a, r, g, b);
}
public static string ConvertColorToHex(Color color)
{
return $"#{color.A}{color.R}{color.G}{color.B}";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChartCreator.Chart.Utilities
{
public static class ValueFormatHelper
{
public static double Ceiling(double value,int significand)
{
var str = string.Format($"{{0:E{significand}}}", value);
var strs = str.Split('E');
var signValue = double.Parse(strs[0]);
signValue = Math.Ceiling(signValue * Math.Pow(10,significand-1)) / Math.Pow(10, significand-1);
return double.Parse($"{signValue}E{strs[1]}");
}
public static double Round(double value, int significand)
{
var str = string.Format($"{{0:E{significand}}}", value);
var strs = str.Split('E');
var signValue = double.Parse(strs[0]);
signValue = Math.Round(signValue * Math.Pow(10, significand - 1)) / Math.Pow(10, significand - 1);
return double.Parse($"{signValue}E{strs[1]}");
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ChartCreator</RootNamespace>
<AssemblyName>ChartCreator</AssemblyName>
<DefaultLanguage>zh-CN</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17134.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="Chart\AxisGeometry.cs" />
<Compile Include="Chart\BarChart.cs" />
<Compile Include="Chart\BarGroupGeometry.cs" />
<Compile Include="Chart\Chart.cs" />
<Compile Include="Chart\ChartType.cs" />
<Compile Include="Chart\ChartValues.cs" />
<Compile Include="Chart\LegendPosition.cs" />
<Compile Include="Chart\LineChart.cs" />
<Compile Include="Chart\MarkerPosition.cs" />
<Compile Include="Chart\PieChart.cs" />
<Compile Include="Chart\PiePartGeometry.cs" />
<Compile Include="Chart\PolyLineGeometry.cs" />
<Compile Include="Chart\Style\AxisStyle.cs" />
<Compile Include="Chart\Style\BarChartStyle.cs" />
<Compile Include="Chart\Style\ChartStyle.cs" />
<Compile Include="Chart\Style\ChartTextFormat.cs" />
<Compile Include="Chart\Style\ChartThickness.cs" />
<Compile Include="Chart\Style\DotShape.cs" />
<Compile Include="Chart\Style\LegendStyle.cs" />
<Compile Include="Chart\Style\LineChartStyle.cs" />
<Compile Include="Chart\Style\PieChartStyle.cs" />
<Compile Include="Chart\Utilities\ChartDrawHelper.cs" />
<Compile Include="Chart\Utilities\ColorConverter.cs" />
<Compile Include="Chart\Utilities\ValueFormatHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\ChartCreator.rd.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.8</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>11.0.2</Version>
</PackageReference>
<PackageReference Include="Win2D.uwp">
<Version>1.21.0</Version>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29020.237
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChartCreator", "ChartCreator.csproj", "{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|ARM.ActiveCfg = Debug|ARM
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|ARM.Build.0 = Debug|ARM
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|x64.ActiveCfg = Debug|x64
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|x64.Build.0 = Debug|x64
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|x86.ActiveCfg = Debug|x86
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Debug|x86.Build.0 = Debug|x86
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|Any CPU.Build.0 = Release|Any CPU
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|ARM.ActiveCfg = Release|ARM
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|ARM.Build.0 = Release|ARM
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|x64.ActiveCfg = Release|x64
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|x64.Build.0 = Release|x64
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|x86.ActiveCfg = Release|x86
{C4782FE9-837D-4E4B-94A9-CE037AF6C6BB}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4675C818-54A7-4D47-A6AA-0EC9942BF311}
EndGlobalSection
EndGlobal
Busing System.Reflection; Busing System.Reflection;
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件包含运行时指令,应用程序通过反射和其他动态代码模式
所访问的类型的规范。运行时指令用于控制
.NET Native 优化器,并确保它不会删除你的库所访问的代码。如果你的
库不进行任何反射,那么一般而言你无需编辑此文件。但是,
如果你的库反射类型,尤其是传递到它或从它的类型所派生的类型,
那么就应该编写运行时指令。
库中反射最常见的使用方式是发现传递到库的
类型的信息。运行时指令有三种方式来表达传递给库的
类型的要求
1. Parameter、GenericParameter、TypeParameter、TypeEnumerableParameter
使用这些指令可反射作为参数传递的类型。
2. SubTypes
使用 SubTypes 指令反射从其他类型派生的类型。
3. AttributeImplies
使用 AttributeImplies 指令指示你的库需要反射使用
属性修饰的类型或方法。
有关为库编写运行时指令的详细信息,请参阅
https://go.microsoft.com/fwlink/?LinkID=391919
-->
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="ChartCreator">
<!--在此处为库添加指令-->
</Library>
</Directives>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment