diff --git a/DOSPORTAL/templates/records/record_detail.html b/DOSPORTAL/templates/records/record_detail.html index 1be67ef..1914b11 100644 --- a/DOSPORTAL/templates/records/record_detail.html +++ b/DOSPORTAL/templates/records/record_detail.html @@ -25,16 +25,24 @@
+
@@ -72,9 +80,86 @@ // https://portal.dos.ust.cz/measurement/94d199b7-3c76-4154-a6c5-5c81236b3e71/visualizate/ + var chart = echarts.init(document.getElementById('graph2'), { + width: 'auto', + }); + + chart.setOption({ + title: { + text: 'Energy' + }, + toolbox: { + right: 10, + feature: { + + restore: {}, + saveAsImage: {} + } + }, + legend: { + data: ['CTS'] + }, + grid: [ + { + left: '5%', + right: '5%', + height: '40%', + bottom: '58%', + }, + { + left: '5%', + right: '5%', + height: '40%', + bottom: '8%', + } + ], + dataZoom: [ + makeDataZoom({ + height: '5%', + bottom: '50%', + xAxisIndex: 0 + }), + makeDataZoom({ + height: '5%', + bottom: 0, + xAxisIndex: 1 + }), + ], + xAxis: [{ + type: 'time', + min: 'dataMin', + max: 'dataMax' + }, { + gridIndex: 1, + type: 'time', + min: 'dataMin', + max: 'dataMax' + }], + yAxis: [{ + min: 0, + max: 'dataMax', + }, { + gridIndex: 1, + min: 'dataMin', + max: 'dataMax', + }], + + series: [ + { + datasetId: 'evolution', + data: [120, 200, 150], + type: 'line' + } + ] + +}); + + +/* var myChart = echarts.init(document.getElementById('graph1'), { width: 'auto', }); + myChart.setOption({ title: { text: 'Dose' @@ -141,7 +226,7 @@ }], series: [ { - datasetId: 'evolution A', + datasetId: 'evolution', name: 'cts', type: 'scatter', xAxisIndex: 0, @@ -152,90 +237,53 @@ { name: 'Energetic spectrum', type: 'scatter', - datasetId: 'spectrum A', - xAxisIndex: 1, - yAxisIndex: 1, - encode: {x:'energy',y:'cts'}, - symbolSize: 4, - }, - { - datasetId: 'evolution B', - name: 'cts', - type: 'scatter', - xAxisIndex: 0, - yAxisIndex: 0, - encode: {x:'time',y:'cts'}, - symbolSize: 6, - }, - { - name: 'Energetic spectrum', - type: 'scatter', - datasetId: 'spectrum B', + datasetId: 'spectrum', xAxisIndex: 1, yAxisIndex: 1, encode: {x:'energy',y:'cts'}, - symbolSize: 8, + symbolSize: 3, } ] }); -myChart.showLoading(); +//myChart.showLoading(); +//myChart.hideLoading(); -d3.csv("./get_evolution/", - d3.autotype).then(function (data) { - console.log(data); - myChart.hideLoading(); - myChart.setOption({ - dataset: [{ - id: 'evolution A', - source: data, - }], - - }); +myChart.setOption({ + series: [{ + id: 'spectrum', + data: [100, 1, 120, 2, 110, 1], + }], + }); -d3.csv("./get_spectrum/", - d3.autotype).then(function (data) { - console.log(data); - myChart.hideLoading(); - myChart.setOption({ - dataset: [{ - id: 'spectrum A', - source: data, - }], - - }); -}); - -d3.csv("./get_evolution/", - d3.autotype).then(function (data) { +d3.csv("./get_spectrum/", d3.autotype).then(function (data) { console.log(data); myChart.hideLoading(); myChart.setOption({ dataset: [{ - id: 'evolution B', - source: data, + id: 'spectrum', + source: [[100, 1], [120, 2], [110, 1]], }], }); }); +d3.csv("./get_evolution/", d3.autotype).then(function (data) { -d3.csv("./get_spectrum/", - d3.autotype).then(function (data) { console.log(data); myChart.hideLoading(); - myChart.setOption({ - dataset: [{ - id: 'spectrum B', - source: data, - }], - - }); + //myChart.setOption({ + // dataset: [{ + // id: 'evolution', + // source: data, + // }], + // }); }); +*/ diff --git a/DOSPORTAL/views_record.py b/DOSPORTAL/views_record.py index b7fcae6..f912bbd 100644 --- a/DOSPORTAL/views_record.py +++ b/DOSPORTAL/views_record.py @@ -13,6 +13,8 @@ from django.views import generic from django.views.generic import ListView +import pandas as pd + from .forms import RecordForm @@ -145,9 +147,17 @@ def RecordView(request, pk): def GetSpectrum(request, pk): - record_o = Record.objects.filter(pk=pk) - print(record_o) - pass + print("Get Spectrum", pk) + + record = Record.objects.filter(pk=pk) + print(record) + + df = pd.read_pickle(record[0].data_file.path) + print(df) + + + + return JsonResponse({'data': 'data'}) @@ -155,4 +165,7 @@ def GetEvolution(request, pk): record_o = Record.objects.filter(pk=pk) print(record_o) - pass \ No newline at end of file + + + + return JsonResponse({'data': 'data'}) \ No newline at end of file