Of course, that is also possible; we just have to individually assign data to different YAxis, and in that case you wouldn’t have to use append either, but simply you can use single query to fetch two different metrics, but this should work in both cases, take a look:
import React from "react";
import { useDql } from "@dynatrace-sdk/react-hooks";
import { TimeseriesChart } from "@dynatrace/strato-components-preview/charts";
import { Flex } from "@dynatrace/strato-components/layouts";
import { ProgressBar } from "@dynatrace/strato-components/content";
import { convertToTimeseries } from "@dynatrace/strato-components-preview/conversion-utilities";
import { format, units } from "@dynatrace-sdk/units";
export const Data = () => {
// Option 1: Your suggested append syntax
const query = `timeseries response_time = avg(dt.service.request.response_time) | append [timeseries request_count=count(dt.service.request.count)]`;
// Option 2: Alternative multi-metric syntax
// const query = `timeseries avg(dt.service.request.response_time), count(dt.service.request.count)`;
const result = useDql({
query,
});
if (result.data === undefined) {
return <ProgressBar />;
}
const [responseTimeTimeseries, requestCountTimeseries] = convertToTimeseries(
result.data.records,
result.data.types
);
// Set proper units - this helps with the automatic formatting
responseTimeTimeseries.unit = "microseconds"; // Keep original unit info
return (
<Flex flexDirection="column">
<TimeseriesChart style={{ padding: "8px", boxSizing: "border-box" }}>
<TimeseriesChart.YAxis
position="left"
label="Response Time"
formatter={(value) =>
format(value, {
input: units.time.microsecond,
maximumFractionDigits: 0,
})
}
/>
<TimeseriesChart.YAxis position="right" label="Request Count" />
<TimeseriesChart.Line data={responseTimeTimeseries} />
<TimeseriesChart.Line data={requestCountTimeseries} />
</TimeseriesChart>
</Flex>
);
};
Let me know if that’s your wanted result ![]()