function drawBar(newData) {
	newData.forEach(function(d, i) {
		d.name = d.name;
		d.value = +d.value;
	});
	xBar.domain(newData.map(function(d) { return d.name; }));
	yBar.domain([0, d3.max(newData, function(d) { return d.value; })]);

	const tipBar = d3.tip()
		.attr('class', 'd3-tip')
		.offset([-10, 0])
		.html(function(d) {
			let decimal = d.value.toFixed(2);
			return "<strong>" + d.name + "</strong> <span>" + decimal + "</span>";
		});
  svgFeat.call(tipBar);

  svgFeat.append("g")
		.attr("class", "grid")
		.attr("transform", "translate(0," + height + ")")
		.call(make_x_gridlines()
			.tickSize(-height)
			.tickFormat(""));
	svgFeat.append("g")
		.attr("class", "grid")
		.call(make_y_gridlines()
			.tickSize(-width)
			.tickFormat(""));
	// Draw bar
	svgFeat.selectAll(".bar")
		.data(newData)
		.enter()
		.append("rect")
		.attr("class", "bar")
		.attr("fill", "#36a2eb")
		.attr("y", function(d) { return yBar(d.value); })
		.attr("height", function(d) { return height - yBar(d.value)})
		.attr("width", xBar.bandwidth())
		.attr("x", function(d) { return xBar(d.name); })
		.on('mouseover', tipBar.show)
		.on('mouseout', tipBar.hide);
	// Add the X Axis
	svgFeat.append("g")
		.attr("transform", "translate(0," + height + ")")
		.style("font-family", "Arial")
		.style("font-size", "7.5px")
		.call(d3.axisBottom(xBar))
		.selectAll("text")	
		.style("text-anchor", "end")
		.attr("dx", "-1em")
		.attr("dy", "-.95em")
		.attr("transform", "rotate(-90)");
	// text label for the x axis
	// svgFeat.append("text")
	// 	.attr("transform", "translate(" + (width/2) + " ," + (height + margin.top + 26) + ")")
	// 	.attr("text-anchor", "middle")
	// 	.style("font-size", "12px")
	// 	.text("Variables");
	// Add the Y Axis
	svgFeat.append("g")
		.style("font-family", "Raleway")
		.style("font-size", "11px")
		.call(d3.axisLeft(yBar).tickFormat(d3.format(".2f")).ticks(6));
	// text label for the y axis
	svgFeat.append("text")
		.attr("transform", "rotate(-90)")
		.attr("y", "-48px")
		.attr("x",0 - (height / 2))
		.attr("dy", "1em")
		.attr("text-anchor", "middle")
		.style("font-size", "12px")
		.text("Relative Importance");
}
// Feature Weights - All Bar Gragh
Feature Weights - All Bar Gragh
Feature Weights - All Bar Gragh
function drawBar(newData) {
	newData.forEach(function(d, i) {
		d.name = d.name;
		d.value = +d.value;
	});
	xBar.domain(newData.map(function(d) { return d.name; }));
	yBar.domain([0, d3.max(newData, function(d) { return d.value; })]);
	const tipBar = d3.tip()
		.attr('class', 'd3-tip')
		.offset([-10, 0])
		.html(function(d) {
			let decimal = d.value.toFixed(2);
			return "<strong>" + d.name + "</strong> <span>" + decimal + "</span>";
		});
  svgFeat.call(tipBar);
  svgFeat.append("g")
		.attr("class", "grid")
		.attr("transform", "translate(0," + height + ")")
		.call(make_x_gridlines()
			.tickSize(-height)
			.tickFormat(""));
	svgFeat.append("g")
		.attr("class", "grid")
		.call(make_y_gridlines()
			.tickSize(-width)
			.tickFormat(""));
	svgFeat.selectAll(".bar")
		.data(newData)
		.enter()
		.append("rect")
		.attr("class", "bar")
		.attr("fill", "#36a2eb")
		.attr("y", function(d) { return yBar(d.value); })
		.attr("height", function(d) { return height - yBar(d.value)})
		.attr("width", xBar.bandwidth())
		.attr("x", function(d) { return xBar(d.name); })
		.on('mouseover', tipBar.show)
		.on('mouseout', tipBar.hide);
	svgFeat.append("g")
		.attr("transform", "translate(0," + height + ")")
		.style("font-family", "Arial")
		.style("font-size", "7.5px")
		.call(d3.axisBottom(xBar))
		.selectAll("text")	
		.style("text-anchor", "end")
		.attr("dx", "-1em")
		.attr("dy", "-.95em")
		.attr("transform", "rotate(-90)");
	svgFeat.append("g")
		.style("font-family", "Raleway")
		.style("font-size", "11px")
		.call(d3.axisLeft(yBar).tickFormat(d3.format(".2f")).ticks(6));
	svgFeat.append("text")
		.attr("transform", "rotate(-90)")
		.attr("y", "-48px")
		.attr("x",0 - (height / 2))
		.attr("dy", "1em")
		.attr("text-anchor", "middle")
		.style("font-size", "12px")
		.text("Relative Importance");
}
function drawBar ( newData ) { newData . forEach ( function ( d , i ) { d . name = d . name ; d . value = + d . value ; } ) ; xBar . domain ( newData . map ( function ( d ) { return d . name ; } ) ) ; yBar . domain ( [ 0 , d3 . max ( newData , function ( d ) { return d . value ; } ) ] ) ; const tipBar = d3 . tip ( ) . attr ( 'class' , 'd3-tip' ) . offset ( [ - 10 , 0 ] ) . html ( function ( d ) { let decimal = d . value . toFixed ( 2 ) ; return "<strong>" + d . name + "</strong> <span>" + decimal + "</span>" ; } ) ; svgFeat . call ( tipBar ) ; svgFeat . append ( "g" ) . attr ( "class" , "grid" ) . attr ( "transform" , "translate(0," + height + ")" ) . call ( make_x_gridlines ( ) . tickSize ( - height ) . tickFormat ( "" ) ) ; svgFeat . append ( "g" ) . attr ( "class" , "grid" ) . call ( make_y_gridlines ( ) . tickSize ( - width ) . tickFormat ( "" ) ) ; svgFeat . selectAll ( ".bar" ) . data ( newData ) . enter ( ) . append ( "rect" ) . attr ( "class" , "bar" ) . attr ( "fill" , "#36a2eb" ) . attr ( "y" , function ( d ) { return yBar ( d . value ) ; } ) . attr ( "height" , function ( d ) { return height - yBar ( d . value ) } ) . attr ( "width" , xBar . bandwidth ( ) ) . attr ( "x" , function ( d ) { return xBar ( d . name ) ; } ) . on ( 'mouseover' , tipBar . show ) . on ( 'mouseout' , tipBar . hide ) ; svgFeat . append ( "g" ) . attr ( "transform" , "translate(0," + height + ")" ) . style ( "font-family" , "Arial" ) . style ( "font-size" , "7.5px" ) . call ( d3 . axisBottom ( xBar ) ) . selectAll ( "text" ) . style ( "text-anchor" , "end" ) . attr ( "dx" , "-1em" ) . attr ( "dy" , "-.95em" ) . attr ( "transform" , "rotate(-90)" ) ; svgFeat . append ( "g" ) . style ( "font-family" , "Raleway" ) . style ( "font-size" , "11px" ) . call ( d3 . axisLeft ( yBar ) . tickFormat ( d3 . format ( ".2f" ) ) . ticks ( 6 ) ) ; svgFeat . append ( "text" ) . attr ( "transform" , "rotate(-90)" ) . attr ( "y" , "-48px" ) . attr ( "x" , 0 - ( height / 2 ) ) . attr ( "dy" , "1em" ) . attr ( "text-anchor" , "middle" ) . style ( "font-size" , "12px" ) . text ( "Relative Importance" ) ; }
Feature Weights - All Bar Gragh
Feature Weights - All Bar Gragh
// Draw bar // Add the X Axis // text label for the x axis // svgFeat.append("text") // 	.attr("transform", "translate(" + (width/2) + " ," + (height + margin.top + 26) + ")") // 	.attr("text-anchor", "middle") // 	.style("font-size", "12px") // 	.text("Variables"); // Add the Y Axis // text label for the y axis