CGRect rect = self.searchBarHolder.bounds;
rect.size.width = [UIScreen mainScreen].bounds.size.width;
searchBar.frame = rect
我有两个JavaScript函数,为每个折线图创建一个数据集数组, 例如
type: "line",
data: {
labels: ["1", "2", "3","4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"],
datasets: [
{
label: "Line One,
data: [19950,21123,22365,23680,25073,26547,28108,29761,31510, 32434, 34543, 37555, 39428, 42094],
backgroundColor: gradient,
borderWidth: 5,
borderColor: '#ebac2e',
pointBackgroundColor: "#FFFFFF",
pointBorderColor: "#FFFFFF",
lineTension: 0,
fill: '+1'
},
{
label: "Line Two",
data: [20186,20374,20563,20754,20947,21142,21339,21537,21738, 22834, 23433, 24564, 25544,26454],
backgroundColor: gradient,
borderColor: "#FFFFFF",
borderDash: [15, 15],
pointBackgroundColor: "#FFFFFF",
pointBorderColor: "#FFFFFF",
lineTension: 0
}
]
},
1)每次用户更改“年”输入的值时,我都需要更新图形,并使用“数学公式”和“数学公式”的新结果传递新的数据数组。循环上面。实现这一目标的最佳方式是什么?我查看了互联网上的各种文章和来源,找不到任何有用的情况,大多数示例更新单个图表行而不是多个,并且似乎只使用单个值而不是整个数据集。 2)图表也应该在每次传递新数据集时生成动画并删除旧数据而不重置图形选项。