# S.Chekanov (C) jHepWork
# show 1D histogram

from java.awt import *
from java.awt import Font
from java.util import Random
from jhplot  import *
from jhplot.shapes  import *


c1 =HPlot("Canvas",600,400)
c1.gTitle("HShape package to draw Java 2D objects")
c1.visible(1)
c1.setDrawLegend(0)
# set the range to trigger the Canvas to show up
c1.setRange(0.0, 1.0, 0.0, 1.0)
c1.update()




# show a line in the NDC system
line = Line(0.1,0.9, 0.2, 0.9)
line.setPosCoord("NDC")
line.setColor(Color.red)
line.setTransparency(0.5)
c1.add(line)
c1.update()


#show a line in the NDC system
line = Line(0.1,0.85, 0.2, 0.85)
line.setDashed(3.0)
line.setPosCoord("NDC")
line.setColor(Color.blue)
line.setTransparency(0.5)
c1.add(line);

# arrow in the NDC system
arr = Arrow(0.85, 0.5, 0.85, 0.7)
arr.setColor(Color.blue)
arr.setPosCoord("NDC")
stroke = BasicStroke(5.0)
arr.setStroke(stroke)
arr.setEndFilled()
c1.add(arr)



# set a picture in the NDC system
file=SystemDir+fSep+"macros"+fSep+"examples"+fSep+"data"+fSep+"anllogo.png"
pic=  Picture(0.8, 0.95, file)
pic.setPosCoord("NDC")
c1.add(pic)

# show circle
cic= Circle(0.5, 0.5, 0.1)
pic.setPosCoord("NDC")
cic.setFill(1)
cic.setColor(Color.red)
cic.setTransparency(0.5)
c1.add(cic)



# set HLabel in the normilised coordinate system
lab=HLabel("HLabel in NDC", 0.5, 0.2, "NDC")
c1.add(lab)

# now show all objects
c1.update()



# export to some image (png,eps,pdf,jpeg...)
# c1.export(Editor.DocMasterName()+".png");

# jHepWork @S.Chekanov