Commit 3f902d31 authored by Balasooriya B.M.D.D's avatar Balasooriya B.M.D.D

Merge branch 'UpdatedGraph' into 'master'

Added codes to graph

See merge request !21
parents 4e90518a e2369f73
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -59,7 +59,7 @@ const Prescription = () => {
const extractTextFromImage = async () => {
if (image) {
setLoading(true);
const apiUrl = 'http://192.168.8.100:5000/extract'; // Replace with your Flask server URL
const apiUrl = 'http://192.168.1.100:5000/extract'; // Replace with your Flask server URL
const formData = new FormData();
formData.append('image', {
......
......@@ -14,11 +14,36 @@ const LineChartComponent = () => {
const { AC, BPD, FL, HC } = extractedValues;
const GA = age;
const data1 = [
{ x: 0, y: 0 }, // Starting point at (0, 0)
{ x: GA, y: parseFloat(BPD.replace('mm', '')) },
const gaData = [
{ value: 0, label: '0' },
{ value: 18, label: '18' },
{ value: 19, label: '19' },
{ value: 20, label: '20' },
{ value: 21, label: '21' },
{ value: 22, label: '22' },
{ value: 23, label: '23' },
{ value: 24, label: '24' },
{ value: 25, label: '25' },
{ value: 26, label: '26' },
{ value: 27, label: '27' },
{ value: 28, label: '28' },
{ value: 29, label: '29' },
{ value: 30, label: '30' },
{ value: 31, label: '31' },
{ value: 32, label: '32' },
{ value: 33, label: '33' },
{ value: 34, label: '34' },
{ value: 35, label: '35' },
{ value: 36, label: '36' },
{ value: 37, label: '37' },
{ value: 38, label: '38' },
];
const data1 = gaData.map((gaDataItem) => ({
x: gaDataItem.value,
y: GA === gaDataItem.value ? parseFloat(BPD.replace('mm', '')) : null,
}));
const upperLimitData1 = [
{ x: 0, y: 0 }, // Upper limit data
{ x: 18, y: 44.1 },
......@@ -69,10 +94,10 @@ const LineChartComponent = () => {
{ x: 38, y: 88.2 }, // Set the limit for the entire range
];
const data2 = [
{ x: 0, y: 0 }, // Starting point at (0, 0)
{ x: GA, y: parseFloat(FL.replace('mm', '')) },
];
const data2 = gaData.map((gaDataItem) => ({
x: gaDataItem.value,
y: GA === gaDataItem.value ? parseFloat(FL.replace('mm', '')) : null,
}));
const upperLimitData2 = [
{ x: 0, y: 0 }, // Upper limit data
......@@ -124,10 +149,10 @@ const LineChartComponent = () => {
{ x: 38, y: 69.8 },
];
const data3 = [
{ x: 0, y: 0 }, // Starting point at (0, 0)
{ x: GA, y: parseFloat(HC.replace('mm', '')) },
];
const data3 = gaData.map((gaDataItem) => ({
x: gaDataItem.value,
y: GA === gaDataItem.value ? parseFloat(HC.replace('mm', '')) : null,
}));
const upperLimitData3 = [
{ x: 0, y: 0 }, // Upper limit data
......@@ -179,10 +204,10 @@ const LineChartComponent = () => {
{ x: 38, y: 322.6 },
];
const data4 = [
{ x: 0, y: 0 }, // Starting point at (0, 0)
{ x: GA, y: parseFloat(AC.replace('mm', '')) },
];
const data4 = gaData.map((gaDataItem) => ({
x: gaDataItem.value,
y: GA === gaDataItem.value ? parseFloat(AC.replace('mm', '')) : null,
}));
const upperLimitData4 = [
{ x: 0, y: 0 }, // Upper limit data
......@@ -244,7 +269,7 @@ const LineChartComponent = () => {
{ x: 'Jun', y: 35 },
];
const chartWidth = 50 * data5.length; // Adjust the factor as needed
const chartWidth = 50 * lowerLimitData4.length; // Adjust the factor as needed
const chartHeight = 200; // You can set this to any desired height
const chartConfig = {
......@@ -265,7 +290,7 @@ const LineChartComponent = () => {
<LineChart
data={{
labels: [0, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38],
labels: gaData.map((gaDataItem) => gaDataItem.label),
datasets: [
{
data: data1.map((item) => item.y),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment