Esempio n. 1
0
# Canvas2D example. Charts using polar coordinates. 

from java.awt import Color
from java.awt import Font
from java.util import Random
from math  import *
from jhplot import HChart,P1D

c1 = HChart("Canvas",600,500, 2, 1)
c1.setGTitle("Polar coordinates")
c1.visible()

c1.cd(1,1)
c1.setName("Polar coordinates-I")
c1.setChartPolar()
p1= P1D("test 1")
p2= P1D("test 2")
# fill
rand = Random() 
for i in range(20):
      x=4.0*i # x-value
      p1.add(i*4, 10.0*rand.nextGaussian());
      p2.add(i*2, 5.0*rand.nextGaussian());
c1.add(p1)
c1.add(p2)
c1.update()

c1.cd(2,1)
p3= P1D("Example")
for i in range(0,3*360,5):
    p3.add( 90-i,i)
Esempio n. 2
0
# Canvas2D example. Charts based on the HChart class. Example I

from java.awt import Color
from java.awt import Font
from java.util import Random
from math import *
from jhplot import HChart, P1D

c1 = HChart("Canvas", 600, 600, 2, 1)
c1.setGTitle("Chart examples")
c1.visible()

c1.cd(1, 1)
c1.setChartBar3D()
# c1.setNameX("")
# c1.setNameY("Numbers")
# c1.setName("Bar example")
c1.valueBar3D(1.0, "First", "category1")
c1.valueBar3D(4.0, "Second", "category2")
c1.valueBar3D(3.0, "Third", "category3")
c1.update()

c1.cd(2, 1)
# c1.setNameX("")
# c1.setNameY("Numbers")
# c1.setName("Bar example")
c1.setChartBar()
c1.valueBar(1.0, "First", "category1")
c1.valueBar(4.0, "Second", "category2")
c1.valueBar(3.0, "Third", "category3")
c1.update()
Esempio n. 3
0
# 2D Plots |  C | 1.7 | S.Chekanov |  Charts based on the HChart

from java.awt import Color
from java.awt import Font
from java.util import Random
from math import *
from jhplot import HChart, P1D

from java.lang import *

# test print streams using java
System.out.println("OK message")
System.err.println("Error message")

c1 = HChart("Canvas", 600, 600, 1, 2)
c1.setGTitle("Chart examples")
c1.cd(1, 1)
c1.visible()

c1.cd(1, 1)
c1.setChartPie()
c1.setName("Pie example")
c1.valuePie("Hamburg", 1.0)
c1.valuePie("London", 2.0)
c1.valuePie("Paris", 1.0)
c1.valuePie("Bern", 1.0)
c1.update()


# new plot
c1.cd(1, 2)
Esempio n. 4
0
# Canvas2D example. Charts using polar coordinates.

from java.awt import Color
from java.awt import Font
from java.util import Random
from math import *
from jhplot import HChart, P1D

c1 = HChart("Canvas", 600, 500, 2, 1)
c1.setGTitle("Polar coordinates")
c1.visible()

c1.cd(1, 1)
c1.setName("Polar coordinates-I")
c1.setChartPolar()
p1 = P1D("test 1")
p2 = P1D("test 2")
# fill
rand = Random()
for i in range(20):
    x = 4.0 * i  # x-value
    p1.add(i * 4, 10.0 * rand.nextGaussian())
    p2.add(i * 2, 5.0 * rand.nextGaussian())
c1.add(p1)
c1.add(p2)
c1.update()

c1.cd(2, 1)
p3 = P1D("Example")
for i in range(0, 3 * 360, 5):
    p3.add(90 - i, i)