Mianowicie znalazłem sobie ładne wykresy w jQuery - o tyle dobrze że już jest gotowy przykład i prawidłowo trzeba wstawić dane.
Wystawiłem sobie dane z innego źródła które dostaje w tablicy.
( [id] => 1 [pozycja] => 1 [nazwa_sklepu] => AAAAA [cena] => 1485 [data_tworzenia] => 2019-12-04 [id_sklep] => 5634192923234 [link_sklep] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_2] => 15778 ) ( [id] => 2 [pozycja] => 2 [nazwa_sklepu] => BBBB [cena] => 1592 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 3 [pozycja] => 3 [nazwa_sklepu] => CCCCC [cena] => 1592 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 4 [pozycja] => 4 [nazwa_sklepu] => DDDDD [cena] => 1392 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 5 [pozycja] => 5 [nazwa_sklepu] => EEEEEE [cena] => 1398 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 )
W tym przykładzie jest jeden dzień ( data_tworzenia ) ale generalnie każdego dnia zmienia się pozycja dla nazwy sklepu. np. w następnym dniu czyli 2019-12-05 dla nazwy sklepu EEEEE może być pozycja 2 a inny może mieć pozycję 5. Jest test tak że w danym dniu może pojawić się nowa nazwa sklepu a inna się nie pojawić w tablicy bo jej nie będzie. Tablica rośnie względem dni więc wyglądało by to tak:
( [id] => 1 [pozycja] => 1 [nazwa_sklepu] => AAAAA [cena] => 1485 [data_tworzenia] => 2019-12-04 [id_sklep] => 5634192923234 [link_sklep] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_2] => 15778 ) ( [id] => 2 [pozycja] => 2 [nazwa_sklepu] => BBBB [cena] => 1592 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 3 [pozycja] => 3 [nazwa_sklepu] => CCCCC [cena] => 1592 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 4 [pozycja] => 4 [nazwa_sklepu] => DDDDD [cena] => 1392 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 5 [pozycja] => 5 [nazwa_sklepu] => EEEEEE [cena] => 1398 [data_tworzenia] => 2019-12-04 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 6 [pozycja] => 1 [nazwa_sklepu] => XXXXXXX [cena] => 1398 [data_tworzenia] => 2019-12-05 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 7 [pozycja] => 2 [nazwa_sklepu] => EEEEEE [cena] => 1398 [data_tworzenia] => 2019-12-05 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 ) ( [id] => 8 [pozycja] => 3 [nazwa_sklepu] => AAAAA [cena] => 1398 [data_tworzenia] => 2019-12-05 [id_ceneo] => 5634192923234 [link_ceneo] => <a href="https://www.xxxx.pl/5634192923234" target="_blank">https://www.xxxx.pl/5634192923234</a> [id_sklep_4qu] => 15778 )
Teraz mam JQuery a wstawianie danych wygląda tak:
data: [{ type: "splineArea", showInLegend: true, name: "name", yValueFormatString: "zł#", xValueFormatString: "DD MM YYYY", dataPoints: [ ] }, { type: "splineArea", showInLegend: true, name: "name", yValueFormatString: "zł#", dataPoints: [ ] }]
Teraz potrzebuje aby wyglądało to tak :
data: [{ type: "splineArea", showInLegend: true, name: "AAAAA", yValueFormatString: "zł#", xValueFormatString: "DD MM YYYY", dataPoints: [ ] }, { type: "splineArea", showInLegend: true, name: "BBBB", yValueFormatString: "zł#", dataPoints: [ ] }, { type: "splineArea", showInLegend: true, name: "CCCCC", yValueFormatString: "zł#", dataPoints: [ ] }, { type: "splineArea", showInLegend: true, name: "DDDDD", yValueFormatString: "zł#", dataPoints: [ ] } , { type: "splineArea", showInLegend: true, name: "EEEEEE", yValueFormatString: "zł#", dataPoints: [ ] }, { type: "splineArea", showInLegend: true, name: "XXXXXXX", yValueFormatString: "zł#", dataPoints: [ ] }
Czyli jeżeli nie istenieje nazwa w Data dokłada nową nazwę. name: "XXXXXXX" oraz nowe dataPoints: { x: new Date(2019, 12, 05), y: 1398 } jeżeli istnieje nazwa do danych gokłada nowe new Date :
{ x: new Date(2019, 12, 04), y: 1398 },
{ x: new Date(2019, 12, 05), y: 1398 }
Będę wdzięczny za pomoc....