Dropdown that generates a graph after pressing a button

I have a dropdown with two values, how do I make a button generate a graph according to what I chose in the dropdown, on the dashboard?

Simple example where data is stored in global context. Your data source is probably different so you'll need to manage that part working on your own.

[{"id":"92439d65cf36da57","type":"ui_dropdown","z":"bf0d83d32eec75c2","name":"","label":"","tooltip":"","place":"Select option","group":"674712f8d915bcc0","order":7,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"data from global property \"one\"","value":"one","type":"str"},{"label":"data from global property \"two\"","value":"two","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":640,"y":1600,"wires":[["3384b9312e6234a8"]]},{"id":"33a9400e7d0b3854","type":"inject","z":"bf0d83d32eec75c2","name":"store fake data to global \"one\" and \"two\"","props":[{"p":"payload.one","v":"[{\"x\":1671355808870,\"y\":19.6},{\"x\":1671357593868,\"y\":19.8},{\"x\":1671359378886,\"y\":20.2},{\"x\":1671361178864,\"y\":20.3},{\"x\":1671362963893,\"y\":20.5},{\"x\":1671364748909,\"y\":20.6},{\"x\":1671366548886,\"y\":20.8},{\"x\":1671368333924,\"y\":20.7},{\"x\":1671370118946,\"y\":20.5},{\"x\":1671371918912,\"y\":20.4},{\"x\":1671373703920,\"y\":20.6},{\"x\":1671375488950,\"y\":20.6},{\"x\":1671377288949,\"y\":20.4},{\"x\":1671379073994,\"y\":20.5},{\"x\":1671380858955,\"y\":20.5},{\"x\":1671382644012,\"y\":20.5},{\"x\":1671384444008,\"y\":20.6},{\"x\":1671386244004,\"y\":20.6},{\"x\":1671388029054,\"y\":20.5},{\"x\":1671389829039,\"y\":20.4},{\"x\":1671391614047,\"y\":20.2},{\"x\":1671393399070,\"y\":20.3},{\"x\":1671395199051,\"y\":20.3},{\"x\":1671396984087,\"y\":20.4},{\"x\":1671398784066,\"y\":20.8},{\"x\":1671400569109,\"y\":20.6},{\"x\":1671402354080,\"y\":20.8},{\"x\":1671404139098,\"y\":20.8},{\"x\":1671405924116,\"y\":20.6},{\"x\":1671407709116,\"y\":20.8},{\"x\":1671409494167,\"y\":20.6},{\"x\":1671411294144,\"y\":20.6},{\"x\":1671413079184,\"y\":20.5},{\"x\":1671414864161,\"y\":20.6},{\"x\":1671416649165,\"y\":20.9},{\"x\":1671418434203,\"y\":20.5},{\"x\":1671420219210,\"y\":20.5},{\"x\":1671422019196,\"y\":20.7},{\"x\":1671423804198,\"y\":20.5},{\"x\":1671425589234,\"y\":20.7},{\"x\":1671427374246,\"y\":20.8},{\"x\":1671429159256,\"y\":20.6},{\"x\":1671430944293,\"y\":20.8},{\"x\":1671432729350,\"y\":20.9},{\"x\":1671434529278,\"y\":20.7},{\"x\":1671436314287,\"y\":20.6},{\"x\":1671438099296,\"y\":20.6},{\"x\":1671439884345,\"y\":20.7},{\"x\":1671441669336,\"y\":20.8},{\"x\":1671443454336,\"y\":20.7},{\"x\":1671445254325,\"y\":20.7},{\"x\":1671447039360,\"y\":20.5},{\"x\":1671448824376,\"y\":20.5},{\"x\":1671450609540,\"y\":20.5},{\"x\":1671452409403,\"y\":20.5},{\"x\":1671454209382,\"y\":20.6},{\"x\":1671455994425,\"y\":20.4},{\"x\":1671457779425,\"y\":20.9},{\"x\":1671459564443,\"y\":20.7},{\"x\":1671461364436,\"y\":20.7},{\"x\":1671463149443,\"y\":20.7},{\"x\":1671464934498,\"y\":20.6},{\"x\":1671466734469,\"y\":20.9},{\"x\":1671468519507,\"y\":20.9},{\"x\":1671470319498,\"y\":20.8},{\"x\":1671472104562,\"y\":20.8},{\"x\":1671473904552,\"y\":20.6},{\"x\":1671475704528,\"y\":20.7},{\"x\":1671477489580,\"y\":20.7},{\"x\":1671479289556,\"y\":20.7},{\"x\":1671481074595,\"y\":20.6},{\"x\":1671482874567,\"y\":20.5},{\"x\":1671484659626,\"y\":20.1},{\"x\":1671486459621,\"y\":20.3},{\"x\":1671488259602,\"y\":20.1},{\"x\":1671490044648,\"y\":20.3},{\"x\":1671491829614,\"y\":20.3},{\"x\":1671493614681,\"y\":20.3},{\"x\":1671495414669,\"y\":20.6},{\"x\":1671497199653,\"y\":20.7},{\"x\":1671498984678,\"y\":20.5},{\"x\":1671500769800,\"y\":20.5},{\"x\":1671502569724,\"y\":20.3},{\"x\":1671504369718,\"y\":20},{\"x\":1671506154735,\"y\":20.1},{\"x\":1671507939759,\"y\":20.2},{\"x\":1671509724746,\"y\":20},{\"x\":1671511509751,\"y\":20},{\"x\":1671513294815,\"y\":20},{\"x\":1671515094794,\"y\":19.9},{\"x\":1671516894778,\"y\":19.9},{\"x\":1671518679844,\"y\":19.8},{\"x\":1671520479823,\"y\":19.5},{\"x\":1671522264839,\"y\":19.5},{\"x\":1671524049878,\"y\":19.9},{\"x\":1671525843002,\"y\":19.5},{\"x\":1671527628007,\"y\":19.8},{\"x\":1671528873026,\"y\":20.1}]","vt":"json"},{"p":"payload.two","v":"[{\"x\":1671354667350,\"y\":35.5},{\"x\":1671356152372,\"y\":35.9},{\"x\":1671356197360,\"y\":36.4},{\"x\":1671356227345,\"y\":36.8},{\"x\":1671356242384,\"y\":37},{\"x\":1671356272387,\"y\":37.4},{\"x\":1671356317363,\"y\":37.9},{\"x\":1671356347327,\"y\":38.4},{\"x\":1671356362397,\"y\":38.6},{\"x\":1671356377366,\"y\":38.9},{\"x\":1671356392366,\"y\":39.1},{\"x\":1671356407331,\"y\":39.4},{\"x\":1671356422401,\"y\":39.6},{\"x\":1671356437344,\"y\":39.9},{\"x\":1671356467338,\"y\":40.3},{\"x\":1671356482410,\"y\":40.6},{\"x\":1671356497319,\"y\":40.9},{\"x\":1671356512364,\"y\":41.1},{\"x\":1671356527336,\"y\":41.4},{\"x\":1671356542367,\"y\":41.7},{\"x\":1671356557353,\"y\":42},{\"x\":1671356572365,\"y\":42.3},{\"x\":1671356587360,\"y\":42.6},{\"x\":1671356602375,\"y\":42.9},{\"x\":1671356617352,\"y\":43.3},{\"x\":1671356633915,\"y\":43.6},{\"x\":1671356647357,\"y\":43.9},{\"x\":1671356662400,\"y\":44.2},{\"x\":1671356692383,\"y\":44.8},{\"x\":1671356707341,\"y\":45.2},{\"x\":1671356722396,\"y\":45.5},{\"x\":1671356737346,\"y\":45.9},{\"x\":1671356752393,\"y\":46.2},{\"x\":1671356767376,\"y\":46.6},{\"x\":1671356782389,\"y\":46.9},{\"x\":1671356797359,\"y\":47.2},{\"x\":1671356812398,\"y\":47.5},{\"x\":1671356827344,\"y\":47.9},{\"x\":1671356842399,\"y\":48.2},{\"x\":1671356857346,\"y\":48.6},{\"x\":1671356872405,\"y\":48.9},{\"x\":1671356887344,\"y\":49.3},{\"x\":1671356902399,\"y\":49.6},{\"x\":1671356917332,\"y\":50},{\"x\":1671356932407,\"y\":50.3},{\"x\":1671356947343,\"y\":50.7},{\"x\":1671356962359,\"y\":51},{\"x\":1671356977349,\"y\":51.4},{\"x\":1671356992386,\"y\":51.7},{\"x\":1671357007336,\"y\":52.1},{\"x\":1671357022369,\"y\":52.4},{\"x\":1671357037324,\"y\":52.7},{\"x\":1671357052364,\"y\":53},{\"x\":1671357067334,\"y\":53.4},{\"x\":1671357082374,\"y\":53.7},{\"x\":1671357097331,\"y\":54},{\"x\":1671357112364,\"y\":54.3},{\"x\":1671357142385,\"y\":54.9},{\"x\":1671357157315,\"y\":55.3},{\"x\":1671357172408,\"y\":55.6},{\"x\":1671357187347,\"y\":55.9},{\"x\":1671357202388,\"y\":56.2},{\"x\":1671357217345,\"y\":56.5},{\"x\":1671357232379,\"y\":56.8},{\"x\":1671357247357,\"y\":57.1},{\"x\":1671357262384,\"y\":57.4},{\"x\":1671357292360,\"y\":57.9},{\"x\":1671357307329,\"y\":58.3},{\"x\":1671357337313,\"y\":58.8},{\"x\":1671357352358,\"y\":59.1},{\"x\":1671357367368,\"y\":59.4},{\"x\":1671357382399,\"y\":59.6},{\"x\":1671357397345,\"y\":59.9},{\"x\":1671357427344,\"y\":60.4},{\"x\":1671357457332,\"y\":60.9},{\"x\":1671357487332,\"y\":61.4},{\"x\":1671357517346,\"y\":61.9},{\"x\":1671357532392,\"y\":62.1},{\"x\":1671357547344,\"y\":62.4},{\"x\":1671357577372,\"y\":62.8},{\"x\":1671357607332,\"y\":63.3},{\"x\":1671357623404,\"y\":63.5},{\"x\":1671357652382,\"y\":63.9},{\"x\":1671357667321,\"y\":64.2},{\"x\":1671357697304,\"y\":64.6},{\"x\":1671357712393,\"y\":64.8},{\"x\":1671357727352,\"y\":65},{\"x\":1671357772402,\"y\":65.6},{\"x\":1671357802359,\"y\":66.1},{\"x\":1671357847312,\"y\":66.6},{\"x\":1671357862405,\"y\":66.8},{\"x\":1671357877315,\"y\":67},{\"x\":1671357893658,\"y\":67.2},{\"x\":1671357922355,\"y\":67.6},{\"x\":1671357967360,\"y\":68.1},{\"x\":1671358012376,\"y\":68.5},{\"x\":1671358042386,\"y\":68.8},{\"x\":1671358072396,\"y\":69.1},{\"x\":1671358132396,\"y\":69.7},{\"x\":1671358177337,\"y\":70.1},{\"x\":1671358252358,\"y\":70.7},{\"x\":1671358372369,\"y\":71.6},{\"x\":1671358537318,\"y\":72.6},{\"x\":1671362137316,\"y\":72.7},{\"x\":1671365737277,\"y\":66.3},{\"x\":1671366562339,\"y\":64.3},{\"x\":1671370162299,\"y\":59.9},{\"x\":1671373762266,\"y\":56.1},{\"x\":1671377362243,\"y\":54.1},{\"x\":1671380947168,\"y\":53.3},{\"x\":1671384532224,\"y\":52.7},{\"x\":1671388132180,\"y\":48.3},{\"x\":1671391717133,\"y\":44.3},{\"x\":1671395317107,\"y\":41.1},{\"x\":1671395602160,\"y\":41.3},{\"x\":1671395662157,\"y\":41.9},{\"x\":1671395707090,\"y\":42.4},{\"x\":1671395752115,\"y\":42.9},{\"x\":1671395797157,\"y\":43.4},{\"x\":1671395842145,\"y\":43.9},{\"x\":1671395872126,\"y\":44.4},{\"x\":1671395902126,\"y\":44.8},{\"x\":1671395917118,\"y\":45},{\"x\":1671395947118,\"y\":45.4},{\"x\":1671395977079,\"y\":45.9},{\"x\":1671396007127,\"y\":46.4},{\"x\":1671396022110,\"y\":46.7},{\"x\":1671396037074,\"y\":47},{\"x\":1671396052144,\"y\":47.3},{\"x\":1671396082155,\"y\":47.8},{\"x\":1671396097085,\"y\":48.1},{\"x\":1671396112128,\"y\":48.4},{\"x\":1671396127083,\"y\":48.8},{\"x\":1671396142154,\"y\":49.1},{\"x\":1671396157124,\"y\":49.5},{\"x\":1671396172144,\"y\":49.8},{\"x\":1671396187088,\"y\":50.2},{\"x\":1671396202132,\"y\":50.5},{\"x\":1671396217092,\"y\":50.9},{\"x\":1671396232119,\"y\":51.3},{\"x\":1671396247089,\"y\":51.7},{\"x\":1671396262125,\"y\":52.1},{\"x\":1671396277128,\"y\":52.5},{\"x\":1671396292152,\"y\":52.9},{\"x\":1671396307126,\"y\":53.3},{\"x\":1671396322131,\"y\":53.7},{\"x\":1671396337095,\"y\":54.1},{\"x\":1671396352134,\"y\":54.5},{\"x\":1671396367120,\"y\":54.9},{\"x\":1671396382148,\"y\":55.4},{\"x\":1671396397106,\"y\":55.8},{\"x\":1671396412147,\"y\":56.3},{\"x\":1671396427114,\"y\":56.7},{\"x\":1671396442145,\"y\":57.1},{\"x\":1671396457079,\"y\":57.6},{\"x\":1671396472158,\"y\":58.1},{\"x\":1671396487071,\"y\":58.6},{\"x\":1671396502146,\"y\":59},{\"x\":1671396517088,\"y\":59.4},{\"x\":1671396532151,\"y\":59.9},{\"x\":1671396547088,\"y\":60.4},{\"x\":1671396562131,\"y\":60.8},{\"x\":1671396577093,\"y\":61.3},{\"x\":1671396592155,\"y\":61.8},{\"x\":1671396607059,\"y\":62.3},{\"x\":1671396622113,\"y\":62.6},{\"x\":1671396637082,\"y\":63.1},{\"x\":1671396652132,\"y\":63.5},{\"x\":1671396667094,\"y\":64},{\"x\":1671396682119,\"y\":64.4},{\"x\":1671396697108,\"y\":64.9},{\"x\":1671396712121,\"y\":65.3},{\"x\":1671396727795,\"y\":65.7},{\"x\":1671396742167,\"y\":66},{\"x\":1671396758371,\"y\":66.4},{\"x\":1671396772141,\"y\":66.8},{\"x\":1671396787134,\"y\":67.3},{\"x\":1671396802151,\"y\":67.6},{\"x\":1671396817132,\"y\":68},{\"x\":1671396832231,\"y\":68.3},{\"x\":1671396847292,\"y\":68.8},{\"x\":1671396862140,\"y\":69.1},{\"x\":1671396877227,\"y\":69.4},{\"x\":1671396892237,\"y\":69.8},{\"x\":1671396907223,\"y\":70.1},{\"x\":1671396922225,\"y\":70.4},{\"x\":1671396937225,\"y\":70.8},{\"x\":1671396952134,\"y\":71},{\"x\":1671396967097,\"y\":71.3},{\"x\":1671396982113,\"y\":71.6},{\"x\":1671397012132,\"y\":72.1},{\"x\":1671397042113,\"y\":72.6},{\"x\":1671397072146,\"y\":73.1},{\"x\":1671397087085,\"y\":73.3},{\"x\":1671397102144,\"y\":73.6},{\"x\":1671397147056,\"y\":74.1},{\"x\":1671397162107,\"y\":74.3},{\"x\":1671397192140,\"y\":74.6},{\"x\":1671397237080,\"y\":75.1},{\"x\":1671397312133,\"y\":75.8},{\"x\":1671397342135,\"y\":76.1},{\"x\":1671397402142,\"y\":76.6},{\"x\":1671400972097,\"y\":75.8},{\"x\":1671401017092,\"y\":75.4},{\"x\":1671401077084,\"y\":74.8},{\"x\":1671401122122,\"y\":74.3},{\"x\":1671401152132,\"y\":74},{\"x\":1671401212109,\"y\":73.5},{\"x\":1671401242134,\"y\":73.3},{\"x\":1671401302105,\"y\":72.8},{\"x\":1671401377073,\"y\":72.3},{\"x\":1671404962255,\"y\":68.9},{\"x\":1671408562055,\"y\":65.8},{\"x\":1671412146978,\"y\":64.4},{\"x\":1671415732040,\"y\":62.6},{\"x\":1671419332010,\"y\":62.4},{\"x\":1671422931971,\"y\":62.1},{\"x\":1671426516902,\"y\":61.1},{\"x\":1671430101928,\"y\":59.8},{\"x\":1671433686855,\"y\":58.1},{\"x\":1671437271884,\"y\":55.3},{\"x\":1671440856818,\"y\":51.8},{\"x\":1671444441848,\"y\":51.7},{\"x\":1671448041818,\"y\":49.1},{\"x\":1671451626790,\"y\":43.4},{\"x\":1671455226755,\"y\":38.7},{\"x\":1671456231766,\"y\":37.6},{\"x\":1671459816719,\"y\":37.7},{\"x\":1671461406697,\"y\":37.4},{\"x\":1671461451743,\"y\":37.9},{\"x\":1671461481748,\"y\":38.4},{\"x\":1671461496742,\"y\":38.6},{\"x\":1671461511764,\"y\":38.9},{\"x\":1671461526698,\"y\":39.1},{\"x\":1671461541772,\"y\":39.4},{\"x\":1671461571748,\"y\":39.8},{\"x\":1671461586701,\"y\":40.1},{\"x\":1671461601774,\"y\":40.4},{\"x\":1671461616721,\"y\":40.6},{\"x\":1671461631730,\"y\":40.9},{\"x\":1671461646721,\"y\":41.3},{\"x\":1671461661734,\"y\":41.5},{\"x\":1671461676709,\"y\":41.9},{\"x\":1671461691738,\"y\":42.2},{\"x\":1671461706703,\"y\":42.6},{\"x\":1671461721740,\"y\":42.9},{\"x\":1671461736722,\"y\":43.3},{\"x\":1671461751761,\"y\":43.6},{\"x\":1671461766733,\"y\":44},{\"x\":1671461781747,\"y\":44.4},{\"x\":1671461796747,\"y\":44.8},{\"x\":1671461811753,\"y\":45.1},{\"x\":1671461826729,\"y\":45.6},{\"x\":1671461843055,\"y\":45.9},{\"x\":1671461856740,\"y\":46.4},{\"x\":1671461871759,\"y\":46.8},{\"x\":1671461886694,\"y\":47.2},{\"x\":1671461901764,\"y\":47.6},{\"x\":1671461916691,\"y\":48.1},{\"x\":1671461931730,\"y\":48.4},{\"x\":1671461946713,\"y\":48.9},{\"x\":1671461961769,\"y\":49.3},{\"x\":1671461976713,\"y\":49.8},{\"x\":1671461991771,\"y\":50.3},{\"x\":1671462006714,\"y\":50.7},{\"x\":1671462021741,\"y\":51.1},{\"x\":1671462036703,\"y\":51.6},{\"x\":1671462051728,\"y\":52},{\"x\":1671462066719,\"y\":52.4},{\"x\":1671462081731,\"y\":52.9},{\"x\":1671462096731,\"y\":53.3},{\"x\":1671462111871,\"y\":53.8},{\"x\":1671462126713,\"y\":54.2},{\"x\":1671462141741,\"y\":54.6},{\"x\":1671462156671,\"y\":55.1},{\"x\":1671462171744,\"y\":55.5},{\"x\":1671462186715,\"y\":55.9},{\"x\":1671462201728,\"y\":56.3},{\"x\":1671462216719,\"y\":56.8},{\"x\":1671462231751,\"y\":57.2},{\"x\":1671462246723,\"y\":57.6},{\"x\":1671462261766,\"y\":58},{\"x\":1671462276722,\"y\":58.4},{\"x\":1671462291756,\"y\":58.8},{\"x\":1671462306698,\"y\":59.3},{\"x\":1671462321750,\"y\":59.6},{\"x\":1671462336693,\"y\":60.1},{\"x\":1671462351728,\"y\":60.4},{\"x\":1671462366692,\"y\":60.8},{\"x\":1671462381769,\"y\":61.2},{\"x\":1671462396692,\"y\":61.6},{\"x\":1671462411724,\"y\":61.9},{\"x\":1671462426712,\"y\":62.3},{\"x\":1671462441786,\"y\":62.6},{\"x\":1671462456711,\"y\":63},{\"x\":1671462471724,\"y\":63.3},{\"x\":1671462486710,\"y\":63.7},{\"x\":1671462501729,\"y\":64},{\"x\":1671462516706,\"y\":64.3},{\"x\":1671462531718,\"y\":64.6},{\"x\":1671462561737,\"y\":65.1},{\"x\":1671462591739,\"y\":65.6},{\"x\":1671462621758,\"y\":66.1},{\"x\":1671462651747,\"y\":66.4},{\"x\":1671462666700,\"y\":66.7},{\"x\":1671462696708,\"y\":67},{\"x\":1671462711752,\"y\":67.2},{\"x\":1671462741752,\"y\":67.5},{\"x\":1671462756680,\"y\":67.7},{\"x\":1671462802910,\"y\":68.2},{\"x\":1671462833112,\"y\":68.6},{\"x\":1671462876673,\"y\":69},{\"x\":1671462891762,\"y\":69.2},{\"x\":1671462921732,\"y\":69.5},{\"x\":1671462951725,\"y\":69.8},{\"x\":1671462966716,\"y\":70},{\"x\":1671463041737,\"y\":70.7},{\"x\":1671463086690,\"y\":71.1},{\"x\":1671466686685,\"y\":72.4},{\"x\":1671470286589,\"y\":66.5},{\"x\":1671473871657,\"y\":67.2},{\"x\":1671477456640,\"y\":63.3},{\"x\":1671481056616,\"y\":62.6},{\"x\":1671484656604,\"y\":58.2},{\"x\":1671488256566,\"y\":54.1},{\"x\":1671491841582,\"y\":53.6},{\"x\":1671495441544,\"y\":52.5},{\"x\":1671499026481,\"y\":47.9},{\"x\":1671502611579,\"y\":43.9},{\"x\":1671506211534,\"y\":40.9},{\"x\":1671509811470,\"y\":38.4},{\"x\":1671513396391,\"y\":36.1},{\"x\":1671516981453,\"y\":34.7},{\"x\":1671520581441,\"y\":34.5},{\"x\":1671524076382,\"y\":34.9},{\"x\":1671524136397,\"y\":35.4},{\"x\":1671524181412,\"y\":35.9},{\"x\":1671524226431,\"y\":36.4},{\"x\":1671524257137,\"y\":36.8},{\"x\":1671524271375,\"y\":37},{\"x\":1671524301398,\"y\":37.4},{\"x\":1671524331412,\"y\":37.9},{\"x\":1671524346376,\"y\":38.1},{\"x\":1671524361402,\"y\":38.4},{\"x\":1671524376367,\"y\":38.6},{\"x\":1671524392751,\"y\":38.9},{\"x\":1671524429315,\"y\":39.6},{\"x\":1671524444346,\"y\":39.9},{\"x\":1671524459351,\"y\":40.3},{\"x\":1671524474362,\"y\":40.5},{\"x\":1671524489316,\"y\":40.8},{\"x\":1671524504375,\"y\":41.1},{\"x\":1671524519352,\"y\":41.4},{\"x\":1671524534386,\"y\":41.8},{\"x\":1671524549356,\"y\":42.1},{\"x\":1671524564375,\"y\":42.4},{\"x\":1671524579334,\"y\":42.8},{\"x\":1671524594378,\"y\":43.1},{\"x\":1671524609311,\"y\":43.4},{\"x\":1671524624353,\"y\":43.8},{\"x\":1671524639321,\"y\":44.1},{\"x\":1671524654385,\"y\":44.4},{\"x\":1671524670808,\"y\":44.8},{\"x\":1671524684385,\"y\":45.1},{\"x\":1671524699317,\"y\":45.5},{\"x\":1671524714356,\"y\":45.8},{\"x\":1671524729300,\"y\":46.1},{\"x\":1671524746045,\"y\":46.5},{\"x\":1671524759347,\"y\":46.9},{\"x\":1671524774364,\"y\":47.2},{\"x\":1671524789324,\"y\":47.5},{\"x\":1671524804352,\"y\":47.9},{\"x\":1671524819340,\"y\":48.3},{\"x\":1671524834354,\"y\":48.6},{\"x\":1671524849312,\"y\":48.9},{\"x\":1671524864355,\"y\":49.3},{\"x\":1671524879319,\"y\":49.6},{\"x\":1671524894380,\"y\":49.9},{\"x\":1671524909341,\"y\":50.3},{\"x\":1671524924367,\"y\":50.6},{\"x\":1671524939344,\"y\":51},{\"x\":1671524954386,\"y\":51.3},{\"x\":1671524969854,\"y\":51.7},{\"x\":1671524984404,\"y\":52},{\"x\":1671524999338,\"y\":52.4},{\"x\":1671525014352,\"y\":52.7},{\"x\":1671525029348,\"y\":53.1},{\"x\":1671525044380,\"y\":53.4},{\"x\":1671525059361,\"y\":53.7},{\"x\":1671525074385,\"y\":54},{\"x\":1671525091495,\"y\":54.4},{\"x\":1671525104359,\"y\":54.7},{\"x\":1671525119316,\"y\":55},{\"x\":1671525134338,\"y\":55.3},{\"x\":1671525149334,\"y\":55.6},{\"x\":1671525164345,\"y\":55.9},{\"x\":1671525179340,\"y\":56.3},{\"x\":1671525194364,\"y\":56.5},{\"x\":1671525209336,\"y\":56.9},{\"x\":1671525224350,\"y\":57.1},{\"x\":1671525239361,\"y\":57.4},{\"x\":1671525254356,\"y\":57.7},{\"x\":1671525269335,\"y\":58},{\"x\":1671525284375,\"y\":58.3},{\"x\":1671525314359,\"y\":58.8},{\"x\":1671525329353,\"y\":59.1},{\"x\":1671525344361,\"y\":59.4},{\"x\":1671525359353,\"y\":59.6},{\"x\":1671525374345,\"y\":59.9},{\"x\":1671525389347,\"y\":60.1},{\"x\":1671525404368,\"y\":60.4},{\"x\":1671525434383,\"y\":60.8},{\"x\":1671525464337,\"y\":61.3},{\"x\":1671525479312,\"y\":61.5},{\"x\":1671525509307,\"y\":61.9},{\"x\":1671525554349,\"y\":62.4},{\"x\":1671525584390,\"y\":62.8},{\"x\":1671525629323,\"y\":63.3},{\"x\":1671525674352,\"y\":63.8},{\"x\":1671525704353,\"y\":64.1},{\"x\":1671525749331,\"y\":64.6},{\"x\":1671525809344,\"y\":65.1},{\"x\":1671525944378,\"y\":66.1},{\"x\":1671528869300,\"y\":72.4}]","vt":"json"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":750,"y":1520,"wires":[["c0bd8283ea28cf93"]]},{"id":"c0bd8283ea28cf93","type":"change","z":"bf0d83d32eec75c2","name":"","rules":[{"t":"set","p":"one","pt":"global","to":"payload.one","tot":"msg"},{"t":"set","p":"two","pt":"global","to":"payload.two","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":1520,"wires":[[]]},{"id":"e958d81242e59b08","type":"ui_chart","z":"bf0d83d32eec75c2","name":"","group":"674712f8d915bcc0","order":8,"width":0,"height":0,"label":"{{title}}","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"1000","removeOlderUnit":"1","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1010,"y":1660,"wires":[[]]},{"id":"37036738f460196b","type":"ui_button","z":"bf0d83d32eec75c2","name":"","group":"674712f8d915bcc0","order":9,"width":0,"height":0,"passthru":true,"label":"Generate chart","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"chartSelection","payloadType":"global","topic":"topic","topicType":"msg","x":620,"y":1660,"wires":[["1726c8843bfae187"]]},{"id":"1726c8843bfae187","type":"function","z":"bf0d83d32eec75c2","name":"get and format chart data","func":"node.send({payload:[],title:'Chart'})// clear the chart\n\n//msg.payload is dropdown value so can be \"one\" or \"two\"\nlet series = msg.payload\n// get data from global variable\nlet data = global.get(series)\n\n// data is an array of objects where\n// every object is point where\n// x is timestamp and y is the value\n//[{x:1671355808870,y:19.6},{x:1671357593868,y:19.8}]\n\n// for this example the data is well formatted. \n//that is not always the case so you may need to do some formatting\n\n// chart needs the data to be correctly structured\nlet chartData = [{\n    \"series\": [series],\n    \"data\": [data],\n    \"labels\": [\"\"]\n}]\n\nmsg.title = series.toUpperCase()// send new title to the chart\nmsg.payload = chartData \nreturn msg\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":1660,"wires":[["e958d81242e59b08"]]},{"id":"3384b9312e6234a8","type":"change","z":"bf0d83d32eec75c2","name":"","rules":[{"t":"set","p":"chartSelection","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":1600,"wires":[[]]},{"id":"499c65c5764b7543","type":"ui_ui_control","z":"bf0d83d32eec75c2","name":"","events":"all","x":300,"y":1660,"wires":[["c0a2d3666a280cc2"]]},{"id":"c0a2d3666a280cc2","type":"delay","z":"bf0d83d32eec75c2","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":450,"y":1660,"wires":[["37036738f460196b"]]},{"id":"821281503c2a9e23","type":"comment","z":"bf0d83d32eec75c2","name":"refresh the chart when page reloads","info":"","x":380,"y":1700,"wires":[]},{"id":"674712f8d915bcc0","type":"ui_group","name":"1. group","tab":"8482b305c416b850","order":1,"disp":true,"width":"6","collapse":true,"className":"ordered-1"},{"id":"8482b305c416b850","type":"ui_tab","name":"Away","icon":"dashboard","disabled":false,"hidden":false}]
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.