cylinGraph.qry

  Download

More scripts: Style By Script

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# CylinGraph
# Point CartoScript to draw cylindrical bar graph symbol
# with labels, using database values for heights and labels.
# Script from Using CartoScripts tutorial.
# Read values for element abundances from database
# and assign to variables to use for cylinder heights
cuVal = Geochemistry.Cu;
pbVal = Geochemistry.Pb;
znVal = Geochemistry.Zn;
# Set edge line color and cylinder dimensions
LineStyleSetColor(0,0,0)
longAxis = 120;   shortAxis = 50;
# Set text color and font
LineStyleSetTextColor(0,0,0);
LineStyleSetFont("ARIALBD.TTF");
# Draw three cylinders side by side
LineStyleDropAnchor(1);
LineStyleDrawCylinder(longAxis,shortAxis,cuVal,255,0,0);
LineStyleMoveTo(0,longAxis);
LineStyleDrawCylinder(longAxis,shortAxis,pbVal,0,255,0);
LineStyleMoveTo(0,longAxis);
LineStyleDrawCylinder(longAxis,shortAxis,znVal,0,0,255);
# Draw label centered below each cylinder
LineStyleMoveToAnchor(1);		# move to base of first cylinder
LineStyleMoveTo(-90,100);		# move down to make room for label
LineStyleTextNextPosition("Cu",70,0,0,next_x,next_y,length);
LineStyleMoveTo(180,length * 0.4);	# move label point to left
LineStyleDrawText("Cu",70,0,0);		# to center first label
LineStyleMoveTo(0,longAxis);  		# move right by width of cylinder
LineStyleDrawText("Pb",70,0,0);
LineStyleMoveTo(0,longAxis);
LineStyleDrawText("Zn",70,0,0);