Re: Pgadmin4 System Stats Extension Design

Поиск
Список
Период
Сортировка
От Sahil Harpal
Тема Re: Pgadmin4 System Stats Extension Design
Дата
Msg-id CAKi=nncRPLHwHZ+53vFuF7sB87tTLYXEbD4FPVnAbt8qhLonug@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Pgadmin4 System Stats Extension Design  (Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>)
Ответы Re: Pgadmin4 System Stats Extension Design  (Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>)
Список pgadmin-hackers
Hi Aditya,
On Mon, 7 Aug 2023 at 11:01, Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
Hi Sahil,
I would suggest changing the behaviour in StreamingChart so that it can be used at other places. If you want to reverse it then you can still do it. I had achieved reverse direction with the following piece of code. Basically, creating an array of 75 points, filling it with available points and reverse. You can change it based on reverse=true flag. In your case, simply reverse, not need of 75 points.
Array.from(new Array(xRange).keys()),
...(data.datasets?.map((d)=>{
let ret = [...d.data];
ret.reverse();
return ret;
})??{}),
 
I'm a little confused here. So, the code snippet above is exactly what's used to initialize the data currently.

The expected behavior is that the graph should start from the right side only. However, currently, when the page loads, for a few seconds, the graphs are visible on the left side and then shift to the right.

I think we can skip the reverse if we make changes in the statsReducer method.
action.counter ?  action.incoming[label] - action.counterData[label] : action.incoming[label],
        ...state[label].slice(0, X_AXIS_LENGTH-1),

Here, we are adding new data to the beginning and selecting the first X_AXIS_LENGTH-1 datapoints from the previous state. However, an alternative approach would be to initially take the X_AXIS_LENGTH-1 elements from the end of the array, then add a new element to the end. This would eliminate the need to reverse the array.

I believe this reversal isn't causing any issues, but something might be occurring during graph plotting. Reversing just ensures that the most recent data point remains on the right within the stream.

Thank you,
Sahil

В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Pravesh Sharma
Дата:
Сообщение: [pgadmin-org/pgadmin4] 27c7ea: Added all like options while creating a table. #6377
Следующее
От: Aditya Toshniwal
Дата:
Сообщение: Re: Pgadmin4 System Stats Extension Design