function renderLine(config,first_time){ if(first_time){ var svg = d3.select(config.dom_element).append("svg") .style("width", config.width + config.margin.left + config.margin.right) .style("height", config.height + config.margin.top + config.margin.bottom); svg .append("line") .attr("x1",config.x1) .attr("y1",config.y1) .attr("x2",config.x2) .attr("y2",config.y2) .style("stroke",config.stroke_color) .style("stroke-width",config.stroke_width) $("#x1").val(config.x1); $("#y1").val(config.y1); $("#x2").val(config.x2); $("#y2").val(config.y2); $("#width").val(config.width); $("#height").val(config.height); $("#strokeColor").val(config.stroke_color); $("#strokeWidth").val(config.stroke_width); }else{ var dom_element = d3.select("svg") .style("width", config.width + config.margin.left + config.margin.right) .style("height", config.height + config.margin.top + config.margin.bottom); dom_element.select("line") .attr("x1",config.x1) .attr("y1",config.y1) .attr("x2",config.x2) .attr("y2",config.y2) .style("stroke",config.stroke_color) .style("stroke-width",config.stroke_width); } }