Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8947335e54
Fetching contributors…

Cannot retrieve contributors at this time

executable file 103 lines (76 sloc) 2.988 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
/*
* Copyright 2007-2010 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.liftweb {
package flot_demo {
package web {
package snippet {

import scala.xml.NodeSeq

import net.liftweb.common._
import net.liftweb.util._
import Helpers._
import net.liftweb.http.js.JsCmds._

import net.liftweb.widgets.flot._

/*
*
*/

class Time {

  def render (xhtml: NodeSeq) = {

    def graph () = {

      var d1a : List [Pair [Double, Double]] =
         (-373597200000.0, 315.71) :: (-370918800000.0, 317.45) :: Nil

      var d1b : List [Pair [Double, Double]] =
         (-247366800000.0, 319.69) :: (-244688400000.0, 320.58) :: Nil

      var d2a : List [Pair [Double, Double]] =
         (-123555600000.0, 321.59) :: (-121136400000.0, 322.39) :: Nil

      var d2b : List [Pair [Double, Double]] =
         (-2682000000.0, 324.12) :: (-3600000.0, 325.06) :: Nil

      var d3a : List [Pair [Double, Double]] =
         (113007600000.0, 329.31) :: (115686000000.0, 327.51) :: Nil

      var d3b : List [Pair [Double, Double]] =
         (236559600000.0, 334.73) :: (239238000000.0, 332.52) :: Nil

      var d4a : List [Pair [Double, Double]] =
         (352249200000.0, 341.57) :: (354924000000.0, 342.56) :: Nil


      var d4b : List [Pair [Double, Double]] =
         (478479600000.0, 347.49) :: (481154400000.0, 348.00) :: Nil

      var d5a : List [Pair [Double, Double]] =
         (594342000000.0, 350.04) :: (596934000000.0, 351.29) :: Nil

      var d5b : List [Pair [Double, Double]] =
         (715298400000.0, 352.79) :: (717894000000.0, 353.20) :: Nil

      var d6a : List [Pair [Double, Double]] =
         (830901600000.0, 364.94) :: (833580000000.0, 364.70) :: Nil

      var d6b : List [Pair [Double, Double]] =
         (951865200000.0, 370.38) :: (954540000000.0, 371.63) :: Nil

      var d7a : List [Pair [Double, Double]] =
         (1067641200000.0, 374.77) :: (1070233200000.0, 375.97) :: Nil

      val s = new FlotSerie () {
        override val data = d1a ::: d1b ::: d2a ::: d2b ::: d3a ::: d3b ::: d4a ::: d4b :::
                            d5a ::: d5b ::: d6a ::: d6b ::: d7a
      }

      val options = new FlotOptions () {
        override val xaxis = Full (new FlotAxisOptions () {
          override val mode = Full ("time")
        })
      }

      Flot.render ( "ph_graph", s :: Nil, options, Flot.script(xhtml))
    }

    //

    bind ("flot", xhtml, "graph" -> graph)
  }
}
}
}
}
}
Something went wrong with that request. Please try again.