vis_files/generate_plots.js
/// Highlights an area on the map
Highlights an area on the map
Highlights an area on the map
function highlight_area(vis,c,val,name)
{
	var b = visjson.boundaries;
	cv.lineWidth = 1;
	for(p = 0; p < b[c].length; p++){
		cv.beginPath();
		for(i = 0; i <= b[c][p].length; i++){
			var ii = i%b[c][p].length;
			var x = mapdy*zoomfac*(b[c][p][ii][0]-zoomx), y = mapdy - mapdy*zoomfac*(b[c][p][ii][1]-zoomy);
			if(i == 0) cv.moveTo(x,y);
			else cv.lineTo(x,y);
		}
		cv.strokeStyle = BLACK;
		cv.stroke();
	}
	var ra = visjson.click_bound_range[c];
	var x = mapdy*zoomfac*(ra.xav-zoomx);
	if(val != ""){
		if(vis.type != "OP_LEVEL_EFFECT") val = val.toPrecision(3);
		ww = textwidth(val,MAPBOLDFONT)+5;
		y = mapdy - mapdy*zoomfac*(ra.yav-zoomy);
		cv.globalAlpha = 0.9;
		drawroundrect(x-ww/2,y-10,ww,13,3,WHITE,WHITE); 
		cv.globalAlpha = 1;
		centertext(val,x,y+1,MAPBOLDFONT,BLACK);
	}
	ww = textwidth(vis.areas[c],MAPFONT)+5;
	y = mapdy - mapdy*zoomfac*(ra.ymin-zoomy);
	cv.globalAlpha = 0.9;
	drawroundrect(x-ww/2,y+2,ww,13,3,WHITE,WHITE); 
	cv.globalAlpha = 1;
	centertext(name,x,y+14,MAPFONT,BLACK);
}
function highlight_area ( vis , c , val , name ) { var b = visjson . boundaries ; cv . lineWidth = 1 ; for ( p = 0 ; p < b [ c ] . length ; p ++ ) { cv . beginPath ( ) ; for ( i = 0 ; i <= b [ c ] [ p ] . length ; i ++ ) { var ii = i % b [ c ] [ p ] . length ; var x = mapdy * zoomfac * ( b [ c ] [ p ] [ ii ] [ 0 ] - zoomx ) , y = mapdy - mapdy * zoomfac * ( b [ c ] [ p ] [ ii ] [ 1 ] - zoomy ) ; if ( i == 0 ) cv . moveTo ( x , y ) ; else cv . lineTo ( x , y ) ; } cv . strokeStyle = BLACK ; cv . stroke ( ) ; } var ra = visjson . click_bound_range [ c ] ; var x = mapdy * zoomfac * ( ra . xav - zoomx ) ; if ( val != "" ) { if ( vis . type != "OP_LEVEL_EFFECT" ) val = val . toPrecision ( 3 ) ; ww = textwidth ( val , MAPBOLDFONT ) + 5 ; y = mapdy - mapdy * zoomfac * ( ra . yav - zoomy ) ; cv . globalAlpha = 0.9 ; drawroundrect ( x - ww / 2 , y - 10 , ww , 13 , 3 , WHITE , WHITE ) ; cv . globalAlpha = 1 ; centertext ( val , x , y + 1 , MAPBOLDFONT , BLACK ) ; } ww = textwidth ( vis . areas [ c ] , MAPFONT ) + 5 ; y = mapdy - mapdy * zoomfac * ( ra . ymin - zoomy ) ; cv . globalAlpha = 0.9 ; drawroundrect ( x - ww / 2 , y + 2 , ww , 13 , 3 , WHITE , WHITE ) ; cv . globalAlpha = 1 ; centertext ( name , x , y + 14 , MAPFONT , BLACK ) ; }
Highlights an area on the map
Highlights an area on the map