Hi Dom,

There is currently no support for styling the annotation column on a
per-row basis, either for the color or other ways of drawing the
annotation.  But that is a good idea which we will keep in mind.

And by the way, the AnnotationChart currently doesn't support any other
data columns besides what is documented.  But we plan to generalize its
capabilities so that it will be more like the rest of the Corecharts that
it is based on.  No specific timeline yet on that development.

On Mon, Mar 16, 2015 at 12:33 AM, Brandon Matthews <
[email protected]> wrote:

> This might fall into the suggestion box, ...I was really excited to see
> point customizations listed as 'new' under tooltips. I imagine there are a
> few ways this may be possible, so here goes: I created 8 specific alerts
> that as luck would have it, I named "Red Flag, Yellow Flag, Green Flag,
> etc. I was able to add an additional database field for "Role" so that R =
> Red, Y=Yellow, O= Orange, and because I have 5 levels of Green Flag Alerts,
> I used numerals 1,2,3,4 & 5 to denote each of those. I have 2 charts set up
> and working with this now: You can go to
> http://realshortdata.com/?page_id=950 and enter any ticker symbol in the
> search box...such as "GOOG" or in my example "SIRI" if you'd like a better
> view:
>
>
>
> <https://lh4.googleusercontent.com/-5ybY8g7yv3A/VQZSG-0upXI/AAAAAAAAA-w/n9QThmPh-B4/s1600/SIRI.PNG>
>
>
> <https://lh4.googleusercontent.com/-NTFN3RZUEH8/VQZTS3dqSqI/AAAAAAAAA-8/0uuLwh_LniU/s1600/siri%2B2.PNG>
> Ideally, what I'd like to do besides put the actual shape of a flag which
> is not an option that I can see, (hint, hint)  :)... is be able to color
> code each of the alerts as they occur so that each has a distinct color:
>
>
> I took the liberty of adding a new field to the mysql database table and
> named it 'style". I then applied each specific html color code to each
> specific alert type/color:
>
> example:
>
>  "UPDATE `G1` SET `alert_code` = '1', `style` = '#25F904';";
>  "UPDATE `G2` SET `alert_code` = '2', `style` = '#27D70D';";
>  "UPDATE `G3` SET `alert_code` = '3', `style` = '#24B80D';";
>  "UPDATE `G4` SET `alert_code` = '4', `style` = '#1C9409';";
>  "UPDATE `G5` SET `alert_code` = '5', `style` = '#135A08';";
>  "UPDATE `R1` SET `alert_code` = 'R', `style` = '#DF0101';";
>  "UPDATE `Y1` SET `alert_code` = 'Y', `style` = '#FF8000';";
>  "UPDATE `O1` SET `alert_code` = 'O', `style` = '#FFFF00';";
>
> Which allows me the option if I'm thinking this through correctly, of
> using the color code in a similar query as I use now
>
> date symbolclosealert_codeshort_volume_alertsstyle
> 2014-02-21 SIRI 3.61 Y Yellow Flag Alert #FFFF00
> 2014-02-19 SIRI 3.57 R Red Flag Alert        #DF0101
> 2014-02-11 SIRI 3.57 1 Green Flag Alert1 #25F904
> 2014-02-10 SIRI 3.49 1 Green Flag Alert1 #25F904
>
> $query= "SELECT  EXTRACT(YEAR FROM `date`) AS 'year',
> EXTRACT(MONTH FROM `date`) AS 'month',
> EXTRACT(DAY FROM `date`) AS 'day',
> `close` , `alert_code` , `short_volume_alerts`, (could add in here
> `style`)
> FROM  `alerttable` WHERE `symbol` = '$ticker'  ORDER BY `date` ASC;";
> $result = mysql_query($query);
> $table = array();
> $table['cols'] = array(
>     array('label' => 'Date', 'type' => 'date', 'role' => 'domain'),
>     array('label' => 'Close', 'type' => 'number', 'role' => 'data'),
>     array('label' => '', 'type' =>'string', 'role' => 'annotation'),
>     array('label' => '', 'type' =>'string', 'role' => 'annotationText') 
> (perhaps
> a way to add here?) ie.  'role' =>  'annotationText'*, 'style')*
>                       );
> $rows = array();
>     while($r = mysql_fetch_assoc($result)) {
>                                         $temp = array();
>                                         $r['date']= array($r['year'],
> $r['month']-1, $r['day']);
>                                         $r['date'] = implode(",",
> $r[('date')]);
>                                         $temp[] = array('v'
> =>"Date(".$r['date'].")");
>                                         $temp[] = array('v' => (float)
> $r['close']);
>                                         $temp[] = array('v' =>
> $r['alert_code']);
>                                         $temp[] = array('v' =>
> $r['short_volume_alerts']);
>                                         $rows[] = array('c' => $temp);
>                                         };
> $table['rows'] = $rows;
> $annotdata = json_encode($table);
> ?>
>
> <script type='text/javascript'>
> google.load('visualization', '1', {'packages':['corechart']});
> google.setOnLoadCallback(drawChart);
>    function drawChart() {
> var data = new google.visualization.DataTable(<?=$annotdata?>);
>       var options = {
> title: '<?=$query?>: 6 mn Short Volume Alert Chart',
>                     width: 530,
>                     height: 300
> };
>       var chart = new
> google.visualization.LineChart(document.getElementById('anottchart_div'));
>       chart.draw(data, options);
> };
>      </script>
>
> second chart is pretty much the same
>
> <script type='text/javascript'>
>       google.load('visualization', '1.1',
> {'packages':['annotationchart']});
>       google.setOnLoadCallback(drawChart);
>       function drawChart() {
> var data = new google.visualization.DataTable(<?=$dataannot?>);
>        var options = {
> title: '<?=$query?>: Short Volume Alert Price Chart',
>                      width: 1100,
>                      height: 600,
> displayAnnotations: true,
> displayAnnotationsFilter: true
> };
>        var chart = new
> google.visualization.AnnotationChart(document.getElementById('alertchart_div'));
>        chart.draw(data, options);
>      };
> </script>
>
> I can find my way around php and mysql...after that I'm pretty much a lost
> cause..
>
> is it currently possible, if so  am I close, or miles away?
>
> TIA
>
> Dom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to