areaChartWidgetSeries.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import LineSeries from 'sentry/components/charts/series/lineSeries';
  2. import type {TimeseriesData} from '../common/types';
  3. /**
  4. *
  5. * @param timeserie
  6. * @param complete Whether this series is fully ingested and processed data, or it's still behind the ingestion delay
  7. */
  8. export function AreaChartWidgetSeries(timeserie: TimeseriesData, complete?: boolean) {
  9. return complete
  10. ? LineSeries({
  11. name: timeserie.field,
  12. color: timeserie.color,
  13. stack: 'complete',
  14. animation: false,
  15. areaStyle: {
  16. color: timeserie.color,
  17. opacity: 1.0,
  18. },
  19. data: timeserie.data.map(datum => {
  20. return [datum.timestamp, datum.value];
  21. }),
  22. })
  23. : LineSeries({
  24. name: timeserie.field,
  25. color: timeserie.color,
  26. stack: 'incomplete',
  27. animation: false,
  28. data: timeserie.data.map(datum => {
  29. return [datum.timestamp, datum.value];
  30. }),
  31. lineStyle: {
  32. type: 'dotted',
  33. },
  34. areaStyle: {
  35. color: timeserie.color,
  36. opacity: 0.8,
  37. },
  38. silent: true,
  39. });
  40. }