我有一个按钮,使用d3.js显示折线图.但我想在点击相同按钮时从图表中删除该行.我创建了一个切换按钮,但如何从图表中删除该行?我有以下绘制图形的函数.svg.selectAll("path").remove()正在删除轴而不是行.
function plotGraph(file){
var color = d3.scale.category10();
var svg = d3.select('#mySvg');
svg.selectAll("path").remove();
var line = d3.svg.line().interpolate("basis").x(function(d) {
return x(d.date);
}).y(function(d) {
return y(d.mvalue);
});
d3.csv(file,function(error, data) {
color.domain(d3.keys(data[0]).filter(function(key) {
return key !== "date";
}));
data = data.map(function(d) {
return {
mvalue : +d.mvalue,
date : parseDate(d.date)
};
});
x.domain(d3.extent(data, function(d) {
return d.date;
}));
y.domain([ 0, 100 ]);
svg.append("path").datum(data).attr("class", "line").attr("d",line);
});
Run Code Online (Sandbox Code Playgroud)
}
我想在iOS中显示一个对话框并添加UITextView
到对话框的视图中.该UITextView
TextView的具有对电子邮件,电话和网址可点击的链接文字.我能够触发对话框,但只能使用标题和确定按钮.对话框视图中没有添加textview.我不确定这里的问题是文本视图还是视图添加到对话框的方式.
请检查下面的代码:
UITextView textView = new UITextView();
textView.Editable = false;
textView.DataDetectorTypes = UIDataDetectorType.All;
textView.Message = message;
var dlg = UIAlertController.Create(Title ?? String.Empty, null, UIAlertControllerStyle.Alert);
dlg.View.AddSubview(textView);
dlg.AddAction(UIAlertAction.Create(OkText, UIAlertActionStyle.Default, action => Submit()));
var top = Utils.GetTopViewController();
top.PresentViewController(dlg, animated: true, completionHandler: null);
Run Code Online (Sandbox Code Playgroud)
谢谢,