哈希表中图表上的数据顺序错误 [英] wrong order of data on the chart from hash-table
问题描述
嗨!
我创建了一个这样的哈希表:
I created a hashtable like this:
$ hash
=
@ { " 2010.11.01" = 100 ;
" 2010.12.01" = 80 ;
" 2011.01.01" = 116 ;
" 2011.02.01" = 65;
" 2011.03.01" = 120}
= @{"2010.11.01"=100; "2010.12.01"=80; "2011.01.01"=116; "2011.02.01"=65; "2011.03.01"=120}
我希望图表按此顺序表示这些值。
我以这种方式将hasttable绑定到图表:
I bind the hasttable to the chart this way:
$ Chart
。系列[ " Data" ]。Points.DataBindXY( $ hash 。按键,
$哈希 。值)
.Series["Data"].Points.DataBindXY($hash.Keys, $hash.Values)
但不幸的是它确实出现在这个顺序中。
你知道为什么吗?
非常感谢。
推荐答案
HashTable 不保持顺序这是物品。请参阅 Hashtable.Keys Property :
" ICollection中的密钥顺序未指定"
A HashTable does not maintain the order of it's items. See, Hashtable.Keys Property: "The order of the keys in the ICollection is unspecified"
使用其他类型的
收藏。
这篇关于哈希表中图表上的数据顺序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!