A working demo of the combined progress chart from the requirements: glucose, carbohydrates, basal and bolus insulin on one time axis with three independent Y-axes. Built with Apache ECharts, the same library the app can use through @wuba/react-native-echarts. The data is generated sample data, not a real patient.
Tap or hover a point or bar for details. Pinch, scroll or drag to zoom into a time window; every reading stays on the chart even when the axis shows fewer labels. Shaded band: 70–180 mg/dL target range.
Install echarts, @wuba/react-native-echarts and a renderer (@shopify/react-native-skia or react-native-svg). The buildOption() function on this page can be moved into the app unchanged.
import * as echarts from 'echarts/core';
import {LineChart, BarChart} from 'echarts/charts';
import {GridComponent, TooltipComponent, LegendComponent,
DataZoomComponent, MarkAreaComponent} from 'echarts/components';
import {SkiaRenderer, SkiaChart} from '@wuba/react-native-echarts';
echarts.use([SkiaRenderer, LineChart, BarChart, GridComponent,
TooltipComponent, LegendComponent, DataZoomComponent, MarkAreaComponent]);
function DiaryChart({option, width, height}) {
const ref = useRef(null);
useEffect(() => {
const chart = echarts.init(ref.current, 'light',
{renderer: 'skia', width, height});
chart.setOption(option);
return () => chart.dispose();
}, [option, width, height]);
return <SkiaChart ref={ref} />;
}