cloudy

Author Topic: Flash chart (from clientraw files) - OFC  (Read 36730 times)

0 Members and 2 Guests are viewing this topic.

Offline steve26

  • Posts: 249
  • Drôme - France
Re: Flash chart (from clientraw files)
« Reply #30 on: May 01, 2008, 06:57:28 AM »
Can you give us an example of what you would like to change in your graph ? (background color ? line color ?)

The css files are only used for clientraw_parser.php and clientraw_parser2.php

Offline strandvejr

  • Seaman
  • Posts: 167
  • Sortsø Strand - Denmark
    • Vejrstation Sortsø Strand
Re: Flash chart (from clientraw files)
« Reply #31 on: May 01, 2008, 07:06:03 AM »
background - white #FFFFFF
Line color - grey #CCCCCC
X and Y axis - black
dots on the line - red

strandvejr  :D

Offline steve26

  • Posts: 249
  • Drôme - France
Re: Flash chart (from clientraw files)
« Reply #32 on: May 01, 2008, 07:09:58 AM »
For background color, under :
Quote
$g->title................;

add :
Quote
$g->bg_colour = '#FFFFFF';

For y and x axis color :
Quote
$g->x_axis_colour( '#000', '#000' );
$g->y_axis_colour( '#000', '#000' );

For line color, under
Quote
$g->set_data($data_array);

Add :
Quote
$g->line_dot( 2, 4, '#C0C0C0', '', 10 );
« Last Edit: May 01, 2008, 07:20:03 AM by steve26 »

Offline strandvejr

  • Seaman
  • Posts: 167
  • Sortsø Strand - Denmark
    • Vejrstation Sortsø Strand
Re: Flash chart (from clientraw files)
« Reply #33 on: May 01, 2008, 07:16:36 AM »
great - thank you - I will give it a go

strandvejr  :D :D

Offline steve26

  • Posts: 249
  • Drôme - France
Re: Flash chart (from clientraw files)
« Reply #34 on: May 01, 2008, 07:22:01 AM »
But I don't know for dot's color.
I must leave for now, but i'll looking for that, and/or ask that on OFC support forum asap.
http://sourceforge.net/forum/?group_id=201148

Offline wslangerak

  • Kees
  • Posts: 542
  • Langerak (ZH) - The Netherlands
    • Weerstation Langerak
Re: Flash chart (from clientraw files)
« Reply #35 on: May 01, 2008, 09:02:55 AM »
Hi there,

I don't think the dots can have another color than the lines.

Trying this also (in Dutch), looks OK!

http://www.weerstationlangerak.nl/ofc/outside-temp.php

Good luck!
the delicate sound of thunder.....


Offline steve26

  • Posts: 249
  • Drôme - France
Re: Flash chart (from clientraw files)
« Reply #36 on: May 01, 2008, 09:08:19 AM »
Cool template :-)

Offline steve26

  • Posts: 249
  • Drôme - France
Re: Flash chart (from clientraw files)
« Reply #37 on: May 01, 2008, 09:28:20 AM »
I've got some graphs to work but can't figure out how to auto reload the graphs
The grahs are here: http://www.shermanctweather.com/graph.php


2 small changes to my first answer.
To manage language and manage 2 charts on a webpage.
Ex : http://www.valentinois.net/forums/weatherd/31434/ofc/outside-temp.php?lang=fr

Quote
<script>
   var timerID = 0;
   function reload()
   {
      if (timerID)
      {
         clearTimeout(timerID);
      }
      tmp = findSWF("chart"); /* view your webpage's source to see chart's ID  - id="chart" */
      tmp2 = findSWF("chart_2"); /* view your webpage's source to see chart's ID  - id="chart_2" */
      <?php echo 'x = tmp.reload("chart-outside-temp.php?lang='.$lang.'");' ?> /* reload the first chart with the good language */
      <?php echo 'x = tmp2.reload("chart-outside-temp2.php?lang='.$lang.'");' ?> /* reload the second chart with the good language */
       timerID = setTimeout("reload()", 5000);
   }
   function findSWF(movieName)
   {
      if (navigator.appName.indexOf("Microsoft")!= -1)
      {
         return window["ie_" + movieName]; //add ie_ for Internet Explorer browser
      }
      else
      {
         return document[movieName];
      }
   }
   timerID  = setTimeout("reload()", 5000);
</script>

Before these changes, the default language was always used during the reload.
« Last Edit: May 01, 2008, 10:49:33 AM by steve26 »

Offline strandvejr

  • Seaman
  • Posts: 167
  • Sortsø Strand - Denmark
    • Vejrstation Sortsø Strand
Re: Flash chart (from clientraw files)
« Reply #38 on: May 01, 2008, 10:36:47 AM »
I made a UV-chart - OFC is a great feature

www.strandvejr.dk/ofc/outside-UV.php

Here is the code:
Code: [Select]
<?php
$lang_ok 
= array('fr''en''Den'); //authorized languages array - add your own languages here - create corresponding folders and files !

if(!isset( $_GET['lang'] ) ) $_GET['lang'] = "en"//set $lang to "en" if nothing is define in the url - prevent "Undefined index" message from php

if (in_array($_GET['lang'], $lang_ok)) //test if the language is in authorized array
{
$lang $_GET["lang"];
}
else
{
$lang "Den"//define "en" by default, if $lang have a different value than one in the authorized languages array
}

include_once 
"./lang/".$lang."/labels.php"//include language file (english is default)
include_once "./clientraw_data.php"//include datas from clientraw files

//use the chart class to build the chart:
include_once( './php-ofc-library/open-flash-chart.php' );

//declare news graph
$g = new graph();

//graph title
$g->title$labels_clientraw['79'], '{color: #CCCCCC; font-size: 20; text-align: center}' );
$g->bg_colour '#FFFFFF';

$data_array = array( $data_clientrawextra['511'],$data_clientrawextra['512'],$data_clientrawextra['513'],$data_clientrawextra['514'],$data_clientrawextra['515'],$data_clientrawextra['516'],$data_clientrawextra['517'],$data_clientrawextra['518'],$data_clientrawextra['519'],$data_clientrawextra['520'],$data_clientrawextra['521'],$data_clientrawextra['522'],$data_clientrawextra['523'],$data_clientrawextra['524'],$data_clientrawextra['525'],$data_clientrawextra['526'],$data_clientrawextra['527'],$data_clientrawextra['528'],$data_clientrawextra['529'],$data_clientrawextra['530'],$data_clientrawextra['586'],$data_clientrawextra['587'],$data_clientrawextra['588'],$data_clientrawextra['589']);

$g->set_data($data_array);

//$current_hour = date('H:i');
//date('H:i', strtotime($current_hour."-1 hour"));

$labels_array = array(
$data_clientrawextra['459'],
$data_clientrawextra['460'],
$data_clientrawextra['461'],
$data_clientrawextra['462'],
$data_clientrawextra['463'],
$data_clientrawextra['464'],
$data_clientrawextra['465'],
$data_clientrawextra['466'],
$data_clientrawextra['467'],
$data_clientrawextra['468'],
$data_clientrawextra['469'],
$data_clientrawextra['470'],
$data_clientrawextra['471'],
$data_clientrawextra['472'],
$data_clientrawextra['473'],
$data_clientrawextra['474'],
$data_clientrawextra['475'],
$data_clientrawextra['476'],
$data_clientrawextra['477'],
$data_clientrawextra['478'],
$data_clientrawextra['578'],
$data_clientrawextra['579'],
$data_clientrawextra['580'],
$data_clientrawextra['581']);

$g->set_x_labels($labels_array);
$g->set_x_label_style100);

//set the X and Y legend
$g->set_x_legend$today12'#CCCCCC' );
$g->set_y_legend'UV-Index'12'#CCCCCC' );

$g->line_dot24'#818D9D'''10 );

$g->x_axis_colour'#OOOOOO''#F0F0F0' );
$g->y_axis_colour'#OOOOOO''#ADB5C7' );
$g->y_right_axis_colour'#164166' );

//set the Y min and max
$ymin round(min($data_array)); //get the min outside temp
$ymax round(max($data_array)); //get the max outside temp
$g->set_y_min$ymin );
$g->set_y_max$ymax+);

//label y every 1
$ylabelstep = ($ymax+1)-($ymin);
$g->y_label_steps$ylabelstep );

// display the data
echo $g->render();

?>


strandvejr  :D

Offline steve26

  • Posts: 249
  • Drôme - France
Re: Flash chart (from clientraw files)
« Reply #39 on: May 01, 2008, 10:46:32 AM »
Good work, thank you for the share !
Maybe this chart is usefull for UV chart ?
http://teethgrinder.co.uk/open-flash-chart/gallery-area.php (area filled with a color of your choice).

Offline strandvejr

  • Seaman
  • Posts: 167
  • Sortsø Strand - Denmark
    • Vejrstation Sortsø Strand
Re: Flash chart (from clientraw files)
« Reply #40 on: May 01, 2008, 01:12:04 PM »
Tried the "area hollow" code - and it looks good:

http://www.strandvejr.dk/ofc/outside-UV.php

New code is:

Code: [Select]
<?php
$lang_ok 
= array('fr''en''Den'); //authorized languages array - add your own languages here - create corresponding folders and files !

if(!isset( $_GET['lang'] ) ) $_GET['lang'] = "en"//set $lang to "en" if nothing is define in the url - prevent "Undefined index" message from php

if (in_array($_GET['lang'], $lang_ok)) //test if the language is in authorized array
{
$lang $_GET["lang"];
}
else
{
$lang "Den"//define "en" by default, if $lang have a different value than one in the authorized languages array
}

include_once 
"./lang/".$lang."/labels.php"//include language file (english is default)
include_once "./clientraw_data.php"//include datas from clientraw files

//use the chart class to build the chart:
include_once( './php-ofc-library/open-flash-chart.php' );

//declare news graph
$g = new graph();

//graph title
$g->title$labels_clientraw['79'], '{color: #CCCCCC; font-size: 20; text-align: center}' );
$g->bg_colour '#FFFFFF';

$data_array = array( $data_clientrawextra['511'],$data_clientrawextra['512'],$data_clientrawextra['513'],$data_clientrawextra['514'],$data_clientrawextra['515'],$data_clientrawextra['516'],$data_clientrawextra['517'],$data_clientrawextra['518'],$data_clientrawextra['519'],$data_clientrawextra['520'],$data_clientrawextra['521'],$data_clientrawextra['522'],$data_clientrawextra['523'],$data_clientrawextra['524'],$data_clientrawextra['525'],$data_clientrawextra['526'],$data_clientrawextra['527'],$data_clientrawextra['528'],$data_clientrawextra['529'],$data_clientrawextra['530'],$data_clientrawextra['586'],$data_clientrawextra['587'],$data_clientrawextra['588'],$data_clientrawextra['589']);

$g->set_data($data_array);

//$current_hour = date('H:i');
//date('H:i', strtotime($current_hour."-1 hour"));

$labels_array = array(
$data_clientrawextra['459'],
$data_clientrawextra['460'],
$data_clientrawextra['461'],
$data_clientrawextra['462'],
$data_clientrawextra['463'],
$data_clientrawextra['464'],
$data_clientrawextra['465'],
$data_clientrawextra['466'],
$data_clientrawextra['467'],
$data_clientrawextra['468'],
$data_clientrawextra['469'],
$data_clientrawextra['470'],
$data_clientrawextra['471'],
$data_clientrawextra['472'],
$data_clientrawextra['473'],
$data_clientrawextra['474'],
$data_clientrawextra['475'],
$data_clientrawextra['476'],
$data_clientrawextra['477'],
$data_clientrawextra['478'],
$data_clientrawextra['578'],
$data_clientrawextra['579'],
$data_clientrawextra['580'],
$data_clientrawextra['581']);

$g->set_x_labels($labels_array);
$g->set_x_label_style100);

//set the X and Y legend
$g->set_x_legend$today12'#CCCCCC' );
$g->set_y_legend'UV-Index'12'#CCCCCC' );

// width: 2px, dots: 3px, area alpha: 25% ...
$g->area_hollow2325'#CCCCCC' );
$g->line_dot24'#818D9D'''10 );

$g->x_axis_colour'#OOOOOO''#F0F0F0' );
$g->y_axis_colour'#OOOOOO''#ADB5C7' );
$g->y_right_axis_colour'#164166' );

//set the Y min and max
$ymin round(min($data_array)); //get the min outside temp
$ymax round(max($data_array)); //get the max outside temp
$g->set_y_min$ymin );
$g->set_y_max$ymax+);

//label y every 1
$ylabelstep = ($ymax+1)-($ymin);
$g->y_label_steps$ylabelstep );

// display the data
echo $g->render();

?>



strandvejr  :D

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 22,157
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
    • http://www.realweatherstation.com
Re: Flash chart (from clientraw files)
« Reply #41 on: May 01, 2008, 01:41:08 PM »
Isn't UV index an integer value?

Offline steve26

  • Posts: 249
  • Drôme - France
Re: Flash chart (from clientraw files)
« Reply #42 on: May 01, 2008, 04:29:15 PM »
You're right.
http://www.epa.gov/sunwise/uvcalc.html
It seems that we need to round the value.

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 22,157
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
    • http://www.realweatherstation.com
Re: Flash chart (from clientraw files)
« Reply #43 on: May 01, 2008, 04:38:08 PM »
Great work there Steve26, and others. You've really brought something new to the party with this  :D

Offline niko

  • syzygy
  • Global Moderator
  • Posts: 22,157
  • Crystal Ball broken! Please post the URL.
  • Northern California, U.S.A.
    • http://www.realweatherstation.com
Re: Flash chart (from clientraw files)
« Reply #44 on: May 01, 2008, 04:39:42 PM »
You're right.
http://www.epa.gov/sunwise/uvcalc.html
It seems that we need to round the value.

I'm surprised a Davis VP is sending a non-integer  :?

 

cumulus