Cool! It works a treat! Thanks a lot! rash*
Il giorno martedì 28 aprile 2015 09:33:28 UTC+2, rashmani ha scritto: > > Ciao Daniel, > > thanks, I'll dig that and let you know. > > Thanks again, > rash* > > 'Daniel LaLiberte' via Google Visualization API wrote on 27/04/2015 19:46: > > The colors of items in the timeline chart may not be as predictable as you > want but you could instead add a 'style' role column so you could > associate each item with the color you want. > > On Mon, Apr 27, 2015 at 12:45 PM, rashmani <[email protected]> wrote: > >> Hi Daniel, >> >> yep, I *do* load version 1.1 already... still colors appear not to >> respect my order... :-( >> >> rash* >> >> >> Il giorno lunedì 27 aprile 2015 18:39:52 UTC+2, Daniel LaLiberte ha >> scritto: >>> >>> Filippo, there is a bug in the timeline chart which is fixed in 1.1. If >>> you use google.load('visualization', '1.1', ....) you should see all the >>> colors used. >>> >>> On Mon, Apr 27, 2015 at 12:19 PM, rashmani <[email protected]> wrote: >>> >>>> Uhm, maybe this was a bit too long-winded... >>>> In case, I could rephrase it simpler like this: if I line up in two >>>> arrays values and colors for a timeline chart, in synchronized order, why >>>> my timeline bars do not use the color they're supposed to? Is the values >>>> array passed to the timeline re-sorted somehow before displaying it? >>>> >>>> Cheers, >>>> rash* >>>> >>>> >>>> >>>> >>>> Il giorno sabato 18 aprile 2015 19:18:33 UTC+2, rashmani ha scritto: >>>>> >>>>> Hi there, >>>>> >>>>> I have a problem with custom coloring each bar in a timeline chart. >>>>> I'm building two arrays in PHP like this, for column (bar) values and >>>>> bar colors: >>>>> // holds column headers and values >>>>> $tl_series[] = array( >>>>> array('type'=>'string', 'id'=>'Date'), >>>>> array('type'=>'string', 'id'=>'Value'), >>>>> array('type'=>'date', 'id'=>'Start'), >>>>> array('type'=>'date', 'id'=>'End'), >>>>> ); >>>>> // holds bar colors >>>>> $tlc_series = array(); >>>>> >>>>> Then I'm adding value columns like this: >>>>> foreach ($timeline as $tl_date) { >>>>> .... >>>>> $tl_series[] = array($tl_label, $value, $startdate, >>>>> $enddate); >>>>> $tlc_series[] = <customized_color_hex_value>; >>>>> } >>>>> >>>>> The column values array is then json encoded and passed to a scripted >>>>> javascript function that builds the chart, like this: >>>>> function drawChart' . $chart_id . '() { >>>>> var data = google.visualization.arrayToDataTable(' . >>>>> CJavaScript::jsonEncode($tl_series) . '); >>>>> ... >>>>> >>>>> Finally, I use the $tlc_series colors array as value for timeline's >>>>> colors option: >>>>> ... >>>>> 'colors' => CJavaScript::jsonEncode($tlc_series), >>>>> ... >>>>> >>>>> I have varying number of values, from 2 up to 40, grouped by label and >>>>> distributed between two dates (for those wondering, if any, I'm using YII >>>>> to programmatically get data from MYSQL and draw charts). >>>>> >>>>> Obviously if I have N values, $tl_series will have N+1 elements while >>>>> tlc_series color array will have N elements. >>>>> In my thinking, element $tlc_series[0] should hold color for element >>>>> $tl_series[1]. >>>>> But I'm wrong: not even a simple two values array looks fine. >>>>> What should I do? I tried adding a dummy first element to colors >>>>> array, without success. >>>>> Is the value array somehow reordered when passed to arrayToDataTable >>>>> or to the chart? >>>>> How can I keep value and color arrays synchronized? >>>>> >>>>> Thanks for any suggestion or idea, >>>>> rash* >>>>> >>>>> >>>>> -- >>>> 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] 5CC, Cambridge MA >>> [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. >> > > > > -- > 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 a topic in the > Google Groups "Google Visualization API" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/google-visualization-api/ecqI-mvlO1E/unsubscribe > . > To unsubscribe from this group and all its topics, 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. > > > -- 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.
