When I have the Object 

<canvas-diagram type="bar" width="500" height="400"></canvas-diagram>

and I change one of its attributes the function should fire.





On Friday, January 9, 2015 at 1:37:27 PM UTC+1, David Waterman wrote:
>
> How/where exactly are you changing the attribute? I imagine on an 
> instantiation of this polymer element?
>
> You could, of course, add an intermediate function, itself called by the 
> attributeChanged function and call that function directly; but I suspect 
> you're asking an underlying question.
>
> Max.
>
> On Fri Jan 09 2015 at 18:24:57 Niko Lang <[email protected] 
> <javascript:>> wrote:
>
>> I have a simple canvas object like this:
>>
>> <polymer-element name="canvas-diagram" attributes="type width height 
>> json">
>>   <template>
>>     <div id="canvasField">
>>         Typ: {{type}}, Width:<input value="{{width}}">, Height:{{height
>> }}, json:{{json}}
>>         <div id="canvasContainer">
>>             <canvas id="canvasObj" width="{{width}}" height="{{height}}"
>> ></canvas>
>>         </div>    
>>     </div>
>>   </template>
>>   <script>
>>       function getMaxOfArray(numArray) {
>>         return Math.max.apply(null, numArray);
>>     }
>>     Polymer("canvas-diagram",{
>>         type: "bar",
>>         width: "300",
>>         height: "200",
>>         ready: function() {
>>              console.log("this.ready()");
>>             this.writeDiagram();
>>         },
>>         attributeChanged: function(attrName, oldVal, newVal) {
>>             console.log("this.attributeChanged()");
>>             console.log(attrName, 'old: ' + oldVal, 'new:', newVal);
>>             this.writeDiagram();
>>         },
>>         writeDiagram : function(){
>>            [...]
>>         },
>>         
>>       json: {
>>         data:[
>>             {"name":"Texts","value":"150"},
>>             {"name":"Videos","value":"50"},
>>             {"name":"Audio","value":"30"},
>>             {"name":"Test","value":"20"},
>>             {"name":"Test","value":"20"},
>>             {"name":"Test","value":"20"}
>>         ]}
>>     });
>>   </script>
>> </polymer-element>
>>
>> But when I canhage an attribute manually the attributeChanged() Function 
>> doesnt fire. What am I doing wrong?
>>
>> Follow Polymer on Google+: plus.google.com/107187849809354688692
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Polymer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/polymer-dev/1d271638-10b1-42bb-9faa-c594f4738f07%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/polymer-dev/1d271638-10b1-42bb-9faa-c594f4738f07%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/dcd6077d-51af-4543-b1d2-d95f8aadf684%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to