Windows store apps 使用Winrt xaml工具包多行系列创建热图(光谱图)
我正在使用stack overflow中提供的算法在Windows应用商店应用程序8.1中创建热图 第一种方法:Windows store apps 使用Winrt xaml工具包多行系列创建热图(光谱图),windows-store-apps,winrt-xaml,windows-8.1,heatmap,spectrogram,Windows Store Apps,Winrt Xaml,Windows 8.1,Heatmap,Spectrogram,我正在使用stack overflow中提供的算法在Windows应用商店应用程序8.1中创建热图 第一种方法: public Color HeatMapColor(decimal value, decimal min, decimal max) { decimal val = (value - min) / (max - min); int r = Convert.ToByte(255 * val); int g = Convert.ToByte(255 * (1 -
public Color HeatMapColor(decimal value, decimal min, decimal max)
{
decimal val = (value - min) / (max - min);
int r = Convert.ToByte(255 * val);
int g = Convert.ToByte(255 * (1 - val));
int b = 0;
return Color.FromArgb(255,r,g,b);
}
第二种方法:
public Brush getColourTemp(int maxVal,int minVal ,double actual )
{
int maxVal = 70000000;
int minVal = 100000;
var midVal = (maxVal - minVal) / 2;
int intR;
int intG;
int intB = Convert.ToInt32(Math.Round(0.0));
if (actual >= midVal)
{
intR = 255;
intG = Convert.ToInt32(Math.Round(255 * ((maxVal - actual) / (maxVal - midVal))));
}
else
{
intG = 255;
intR = Convert.ToInt32(Math.Round(255 * ((actual) - minVal) / (midVal - minVal)));
}
// Color background = Color.FromArgb(255, (byte)ran.Next(255), (byte)ran.Next(255), (byte)ran.Next(255));
Color background = Color.FromArgb(255, (byte)intR, (byte)intG, (byte)intB);
return new SolidColorBrush(background);
//byte[] bytes = BitConverter.GetBytes(actual);
//return new SolidColorBrush(Color.FromArgb(bytes[0], bytes[1], bytes[2], bytes[3]));
// return to_rgb(intR, intG, intB);
}
但在这两种情况下,蓝色都是零,为什么。我需要在热图蓝色也可以任何人帮我
我正在使用Winrt xaml工具包线条图创建热图
代码详细信息
for (int i = 0; i <= 200; i++)
{`enter code here`
if (i > 25)
{
LineChart.Series.RemoveAt(0);
}
List<FinancialStuff> financialStuffList = new List<FinancialStuff>();
LineSeries line = new LineSeries();
line.Title = "";
line.IndependentValuePath = "Name";
line.DependentValuePath = "Amount";
for (int j = 0; j < 256; j++)
{
financialStuffList.Add(new FinancialStuff() { Name = i, Amount = j - 130, FavoriteColor = ConvertTotalToRgb(i, j) });
}
line.ItemsSource = financialStuffList;
line.DataPointStyle = style;
LineChart.Series.Add(line);
if (i >= 25)
{
await Task.Delay(TimeSpan.FromSeconds(1));
}
i=50后的性能非常差,速度非常慢,不加载可能是直线图的性能问题,因为这是一个巨大的数字。
请帮助,如果有任何机构可以告诉改进或建议其他方法创建光谱图在windows应用商店应用程序8.1的发展
XAML页面
<Page xmlns:Charting="using:WinRTXamlToolkit.Controls.DataVisualization.Charting"
x:Class="MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Spect"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid >
<Grid.Resources>
<Style
x:Key="ColorByPreferenceColumn"
x:Name="abc"
TargetType="Charting:LineDataPoint">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate
TargetType="Charting:LineDataPoint">
<Grid Background="{Binding FavoriteColor}">
<Polygon>
<Polygon.Fill>
<LinearGradientBrush>
<GradientStop Color="#77ffffff" Offset="0"/>
<GradientStop Color="#00ffffff" Offset="1"/>
</LinearGradientBrush>
</Polygon.Fill>
</Polygon>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Charting:Chart x:Name="LineChart" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" Height="600" Margin="208,107,0,0">
</Charting:Chart>
<Button Content="Data" HorizontalAlignment="Left" Margin="175,31,0,0" VerticalAlignment="Top" Click="Button_Click"/>
</Grid>
intintb=Convert.ToInt32(数学四舍五入(0.0))代码>我不相信写这种声明的人的算法。有人能提出更好的方法来获得热图颜色吗?关于这种类型的东西,在野外已经有很多工作被记录下来,以获得一些灵感。示例,,我尝试了所有选项,其中一个选项中有蓝色,但没有黄色。另一个选项中有黄色,但没有蓝色。有人能帮助我如何在winrt xaml toolkit中隐藏线系列的标题(标题和方框)吗?LineSeries line=新的LineSeries();行。标题=”;但这将只隐藏名称而不是框,因为我有一个数据数组,我将其放入200多个线系列中。请帮助我隐藏该框并改进具有200多个线图的图表的性能。int intB=Convert.ToInt32(Math.Round(0.0))代码>我不相信写这种声明的人的算法。有人能提出更好的方法来获得热图颜色吗?关于这种类型的东西,在野外已经有很多工作被记录下来,以获得一些灵感。示例,,我尝试了所有选项,其中一个选项中有蓝色,但没有黄色。另一个选项中有黄色,但没有蓝色。有人能帮助我如何在winrt xaml toolkit中隐藏线系列的标题(标题和方框)吗?LineSeries line=新的LineSeries();行。标题=”;但这将只隐藏名称,而不是框,因为我有一组数据,我将这些数据放入200多个线系列中。请帮助我隐藏框,并提高包含200多个线图的图表的性能。
<Page xmlns:Charting="using:WinRTXamlToolkit.Controls.DataVisualization.Charting"
x:Class="MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Spect"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid >
<Grid.Resources>
<Style
x:Key="ColorByPreferenceColumn"
x:Name="abc"
TargetType="Charting:LineDataPoint">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate
TargetType="Charting:LineDataPoint">
<Grid Background="{Binding FavoriteColor}">
<Polygon>
<Polygon.Fill>
<LinearGradientBrush>
<GradientStop Color="#77ffffff" Offset="0"/>
<GradientStop Color="#00ffffff" Offset="1"/>
</LinearGradientBrush>
</Polygon.Fill>
</Polygon>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Charting:Chart x:Name="LineChart" HorizontalAlignment="Left" VerticalAlignment="Top" Width="300" Height="600" Margin="208,107,0,0">
</Charting:Chart>
<Button Content="Data" HorizontalAlignment="Left" Margin="175,31,0,0" VerticalAlignment="Top" Click="Button_Click"/>
</Grid>