我是livechart的新手,我在livechart中制作了以下基本图形。但是,我有两个疑问。
using System;
using System.Windows.Forms;
using System.Windows.Media;
using LiveCharts;
using LiveCharts.Defaults;
using LiveCharts.Wpf;
namespace heatmap
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
var converter = new System.Windows.Media.BrushConverter();
var brush = (Brush)converter.ConvertFromString("#000000");
var r = new Random();
cartesianChart1.Series.Add(new HeatSeries
{
Values = new ChartValues<HeatPoint>
{
new HeatPoint(0, 0, 0.25),
new HeatPoint(0, 1, 0.5),
new HeatPoint(0, 2, 0.5),
new HeatPoint(0, 3, 1),
new HeatPoint(1, 0, 0.5),
new HeatPoint(1, 1, 0.5),
new HeatPoint(1, 2, 1),
new HeatPoint(1, 3, 0.5),
//"Robyn Williamson"
new HeatPoint(2, 0, 0.5),
new HeatPoint(2, 1, 1),
new HeatPoint(2, 2, 0.5),
new HeatPoint(2, 3, 0.5),
new HeatPoint(3, 0, 1),
new HeatPoint(3, 1, 0.5),
new HeatPoint(3, 2, 0.25),
new HeatPoint(3, 3, 0.25),
},
Fill=brush,
Stroke=brush,
Foreground = brush,
FontSize=20,
DataLabels = true,
// LabelPoint=val=>"hola",
//The GradientStopCollection is optional
//If you do not set this property, LiveCharts will set a gradient
GradientStopCollection = new GradientStopCollection
{
new GradientStop(Color.FromRgb(255, 255, 255), 0),
new GradientStop(Color.FromRgb(0, 255, 0), .25),
new GradientStop(Color.FromRgb(7, 193, 67), .5),
new GradientStop(Color.FromRgb(0, 128, 0), .75),
new GradientStop(Color.FromRgb(0, 60, 31), 1),
},
});
cartesianChart1.AxisX.Add(new Axis
{
Position = AxisPosition.RightTop,
LabelsRotation = 0,
FontSize=15,
Labels = new[]
{
"variable rent",
"int tax.",
"Real state",
"money"
},
Separator = new Separator { Step = 1 }
});
cartesianChart1.AxisY.Add(new Axis
{
FontSize = 15,
Labels = new[]
{
"Money",
"Real state",
"int tax",
"variable rent"
}
});
}
}
}
如何反转渐变条的顺序?顶部1个,底部0.25个。
每个HeatPoint是否可以为每个标签放置工具提示或颜色(1个标签为白色,其他标签为黄色)?
感谢所有