PalmyraChartStore#

@palmyralabs/palmyra-wire · PalmyraChartStore implements ChartStore<any>

Overview#

One-shot chart-data fetch. Issues a GET against the endpoint with the supplied QueryRequest (filter/sort/pagination), unwraps response.data.result, and returns it as an array ready for your chart library.

No get / save / export — only query. If you need paginated results, use PalmyraGridStore instead.

Obtain via factory.getChartStore(...).

Constructor#

new PalmyraChartStore(
  baseUrl:    string,
  endPoint:   IEndPoint,
  options:    StoreOptions,
  factory?:   APIErrorHandlerFactory,
  idProperty?: strings,
)

Methods#

Method Signature
query query(request: QueryRequest): Promise<any> — returns the unwrapped result array
getClient inherited

Example#

import { useEffect, useState } from 'react';
import ReactApexChart from 'react-apexcharts';
import AppStoreFactory from './wire/StoreFactory';

export function MonthlySalesChart() {
  const [series, setSeries] = useState<any[]>([]);

  useEffect(() => {
    const store = AppStoreFactory.getChartStore({}, '/report/monthly-sales');
    store.query({ filter: { year: 2026 } }).then(rows => {
      setSeries([{ name: 'Sales', data: rows.map((r: any) => [r.month, r.total]) }]);
    });
  }, []);

  return (
    <ReactApexChart
      type="line"
      series={series}
      options={{ chart: { id: 'monthly-sales' }, xaxis: { type: 'category' } }}
    />
  );
}