「改造」の編集履歴(バックアップ)一覧はこちら
「改造」(2008/06/29 (日) 22:40:56) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
改造に協力しろ。
#contents()
*最近の株価の変動をビジュアルに表示する。
kabu.cgiのケツの方をこんな感じで。
↑自分のレベルの低さに泣ける。cgiとか触った程度のド素人だぜぃ。
これってソースの一文でみんな把握できるもんなの?環境こっそりつくってがんばってみるよ。公開とんくす
棒グラフとか描くには、GD::Graphを使うべきか、それはサーバー依存なのか、負荷がどのくらいあるか
まだまだ課題が多いです。でもちょっとづつやるお<int
print "<table border='1' bgcolor='#ffffff' cellspacing='0' cellpadding='0' align='center' width='80%'>\n";
print "<tr><td><b>株価動向</b><br>". _chart() ."</td></tr></table>\n";
print "<div align=\"right\">Edit:たっちゃん<div>\n";
&hooter("login_view","戻る");
exit;
}
sub _chart{
if( -z "./log_dir/kab_hendou.cgi" ){
error( "データファイルが壊れました。1" );
}
open( $in, '<', './log_dir/kab_hendou.cgi' ) || error( "Open Error : ./log_dir/kab_hendou.cgi" );
@event_log = <$in>;
close( $in );
$_current = shift @event_log;
@stock_price = split( "<>", $_current, 6 );
pop @stock_price;
unshift @chartA, $stock_price[0];
unshift @chartB, $stock_price[1];
unshift @chartC, $stock_price[2];
unshift @chartD, $stock_price[3];
unshift @chartE, $stock_price[4];
$ret = '';
foreach( @event_log ){
chomp;
$l = $_;
$ret .= $l;
$l =~ s/<br>//ig;
( $movement, $move ) = split( /\s/, $l );
if( $movement =~ /([A-E])新商品(成功|失敗)/ ){
$meigara = $1;
$stock_price[0] -= $move if "A" eq $meigara;
$stock_price[1] -= $move if "B" eq $meigara;
$stock_price[2] -= $move if "C" eq $meigara;
$stock_price[3] -= $move if "D" eq $meigara;
$stock_price[4] -= $move if "E" eq $meigara;
}else{
@temp = split /,/, $move;
$stock_price[0] -= (split /\s/, $temp[0])[0];
$stock_price[1] -= (split /\s/, $temp[1])[0];
$stock_price[2] -= (split /\s/, $temp[2])[0];
$stock_price[3] -= (split /\s/, $temp[3])[0];
$stock_price[4] -= (split /\s/, $temp[4])[0];
}
unshift @chartA, $stock_price[0];
unshift @chartB, $stock_price[1];
unshift @chartC, $stock_price[2];
unshift @chartD, $stock_price[3];
unshift @chartE, $stock_price[4];
}
$dev = 300;
$img_width = 5;
@loop = ('a','b','c','d','e');
$al->{'A'} = \@chartA;
$al->{'B'} = \@chartB;
$al->{'C'} = \@chartC;
$al->{'D'} = \@chartD;
$al->{'E'} = \@chartE;
$ret2 = '<h2>株価変動</h2>';
foreach $key ( sort keys %$al ) {
$ret2 .= "<p>$key株チャート</p>";
$ret2 .= '<p>';
foreach $a( $al->{$key} ){
foreach( @$a ){
$h = int( $_ / $dev );
$ret2 .= "<img src='$key.gif' height='${h}' width='$img_width'>";
}
}
$ret2 .= '</p>';
}
return $ret . $ret2;
}
**表示サンプル
&ref(chart.png)
改造に協力しろ。
#contents()
*最近の株価の変動をビジュアルに表示する。
kabu.cgiのケツの方をこんな感じで。
-----
↑自分のレベルの低さに泣ける。cgiとか触った程度のド素人だぜぃ。
これってソースの一文でみんな把握できるもんなの?環境こっそりつくってがんばってみるよ。公開とんくす
棒グラフとか描くには、GD::Graphを使うべきか、それはサーバー依存なのか、負荷がどのくらいあるか
まだまだ課題が多いです。でもちょっとづつやるお<int
-----
↑これはGDとか使ってないかなりおバカなグラフだよ。そんなに難しいことはやってない。
print "<table border='1' bgcolor='#ffffff' cellspacing='0' cellpadding='0' align='center' width='80%'>\n";
print "<tr><td><b>株価動向</b><br>". _chart() ."</td></tr></table>\n";
print "<div align=\"right\">Edit:たっちゃん<div>\n";
&hooter("login_view","戻る");
exit;
}
sub _chart{
if( -z "./log_dir/kab_hendou.cgi" ){
error( "データファイルが壊れました。1" );
}
open( $in, '<', './log_dir/kab_hendou.cgi' ) || error( "Open Error : ./log_dir/kab_hendou.cgi" );
@event_log = <$in>;
close( $in );
$_current = shift @event_log;
@stock_price = split( "<>", $_current, 6 );
pop @stock_price;
unshift @chartA, $stock_price[0];
unshift @chartB, $stock_price[1];
unshift @chartC, $stock_price[2];
unshift @chartD, $stock_price[3];
unshift @chartE, $stock_price[4];
$ret = '';
foreach( @event_log ){
chomp;
$l = $_;
$ret .= $l;
$l =~ s/<br>//ig;
( $movement, $move ) = split( /\s/, $l );
if( $movement =~ /([A-E])新商品(成功|失敗)/ ){
$meigara = $1;
$stock_price[0] -= $move if "A" eq $meigara;
$stock_price[1] -= $move if "B" eq $meigara;
$stock_price[2] -= $move if "C" eq $meigara;
$stock_price[3] -= $move if "D" eq $meigara;
$stock_price[4] -= $move if "E" eq $meigara;
}else{
@temp = split /,/, $move;
$stock_price[0] -= (split /\s/, $temp[0])[0];
$stock_price[1] -= (split /\s/, $temp[1])[0];
$stock_price[2] -= (split /\s/, $temp[2])[0];
$stock_price[3] -= (split /\s/, $temp[3])[0];
$stock_price[4] -= (split /\s/, $temp[4])[0];
}
unshift @chartA, $stock_price[0];
unshift @chartB, $stock_price[1];
unshift @chartC, $stock_price[2];
unshift @chartD, $stock_price[3];
unshift @chartE, $stock_price[4];
}
$dev = 300;
$img_width = 5;
@loop = ('a','b','c','d','e');
$al->{'A'} = \@chartA;
$al->{'B'} = \@chartB;
$al->{'C'} = \@chartC;
$al->{'D'} = \@chartD;
$al->{'E'} = \@chartE;
$ret2 = '<h2>株価変動</h2>';
foreach $key ( sort keys %$al ) {
$ret2 .= "<p>$key株チャート</p>";
$ret2 .= '<p>';
foreach $a( $al->{$key} ){
foreach( @$a ){
$h = int( $_ / $dev );
$ret2 .= "<img src='$key.gif' height='${h}' width='$img_width'>";
}
}
$ret2 .= '</p>';
}
return $ret . $ret2;
}
**表示サンプル
&ref(chart.png)