Thank you very much, works perfectly! It changes the color of the point
when I hover over the point where it is below the average. I would however
like to plot a point or marker on top of that point that stays permanently,
i.e. without needing to hover mouse over that point.
On Friday, July 5, 2013 9:11:56 AM UTC-7, asgallant wrote:
>
> Ok. Here's one way to do it:
>
> var data = new google.visualization.DataTable();
> // create columns and populate data
>
> var average = /* input or calculate your average */;
> var view = new google.visualization.DataView(data);
> view.setColumns([0, 1, {
> type: 'number',
> calc: function (dt, row) {
> return (dt.getValue(row, 1) < average) ? {v: dt.getValue(row, 1),
> f: dt.getFormattedValue(row, 1)} : null;
> }
> }]);
>
> var chart = new google.visualization.LineChart(...);
> chart.draw(view, {
> /* options */
> series: {
> 0: {
> pointSize: 3 // pick some size that works for you, should be
> the same for both for best visual continuity
> }
> 1: {
> visibleInLegend: false,
> pointSize: 3, // pick some size that works for you, should be
> the same for both for best visual continuity
> lineWidth: 0
> }
> }
> });
>
> On Friday, July 5, 2013 10:56:37 AM UTC-4, Stef Marais wrote:
>>
>> I just want the point to change color for certain behavior. For instance
>> if the price drops below the average, that point must by hi-lighted or made
>> a different colour. The line should stay the same color throughout
>>
>> On Friday, July 5, 2013 7:32:00 AM UTC-7, asgallant wrote:
>>>
>>> Do you want just the points to change color or do you want the line to
>>> change color too? If you want the line to change color, what behavior do
>>> you want when the line crosses (one point is above and the other below) the
>>> average?
>>>
>>> On Friday, July 5, 2013 5:24:04 AM UTC-4, Stef Marais wrote:
>>>>
>>>> I'm new to PHP. I have managed to plot my data, the price at varying
>>>> dates, using the line chart. I would like to plot points in different
>>>> colours when the price dips below the average.
>>>>
>>>> How can I go about doing this?
>>>>
>>>
--
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/groups/opt_out.