为什么JavaScript的public sealed partial class MainPage : Page
{
private Random _random = new Random();
public MainPage()
{
this.InitializeComponent();
var items1 = new List<NameValueItem>();
var items2 = new List<NameValueItem>();
var items3 = new List<NameValueItem>();
for (int i = 0; i < 3; i++)
{
items1.Add(new NameValueItem { Name = "Name" + i, Value = _random.Next(10, 100) });
}
this.RunIfSelected(this.LineChart, () => ((LineSeries)this.LineChart.Series[0]).ItemsSource = items1);
}
private void RunIfSelected(UIElement element, Action action)
{
action.Invoke();
}
private void LineSeries_Tapped(object sender, TappedRoutedEventArgs e)
{
if (line1.SelectedItem != null)
{
NameValueItem seleteditem = line1.SelectedItem as NameValueItem;
System.Diagnostics.Debug.WriteLine(seleteditem.Name);
System.Diagnostics.Debug.WriteLine(seleteditem.Value);
}
}
}
public class NameValueItem
{
public string Name { get; set; }
public int Value { get; set; }
}
方法有时会四舍五入,有时会缩小?
例如:
toPrecision
&#13;
注意:我注意到除了IE之外的所有浏览器上的这种行为(在IE 11上测试)。