Skip to content

Commit 78f435b

Browse files
authored
fix multichart and date time multichart bug, autodelete htmls (#175)
* fix multichart and date time multichart bug * add file name to legend * Update version.h * add auto delete on close option
1 parent 5b04657 commit 78f435b

5 files changed

Lines changed: 369 additions & 315 deletions

File tree

davis_one/davis.cpp

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ const char kJsUrlToDownolad[] =
4242
} // namespace dvs end
4343

4444
namespace dvs {
45-
// *INDENT-OFF*
46-
const char kHtmlModel[] =
47-
R"(
45+
// *INDENT-OFF*
46+
const char kHtmlModel[] =
47+
R"(
4848
<head>
4949
<title>DAVIS</title>
5050
<script src="./%8" charset="utf-8"></script>
@@ -97,7 +97,7 @@ R"(
9797
</body>
9898
)";
9999

100-
const char kColorMapDefaultPart[] = R"(
100+
const char kColorMapDefaultPart[] = R"(
101101
colorscale: [
102102
['0.0', 'rgb(165,0,38)'],
103103
['0.111111111111', 'rgb(215,48,39)'],
@@ -111,8 +111,7 @@ R"(
111111
['1.0', 'rgb(49,54,149)']
112112
],)";
113113

114-
115-
const char kColorMapSunnyPart[] = R"(
114+
const char kColorMapSunnyPart[] = R"(
116115
colorscale: [
117116
['0.0', 'rgb(250, 134, 7)'],
118117
['0.2', 'rgb(250, 150, 27)'],
@@ -122,7 +121,7 @@ R"(
122121
['1.0', 'rgb(255, 245, 123)']
123122
],)";
124123

125-
const char kColorMapGlamourPart[] = R"(
124+
const char kColorMapGlamourPart[] = R"(
126125
colorscale: [
127126
['0.0', 'rgb(17,63,93)'],
128127
['0.2', 'rgb(88,80,143)'],
@@ -132,7 +131,7 @@ R"(
132131
['1.0', 'rgb(235,248,0)']
133132
],)";
134133

135-
const char kColorMapThermalPart[] = R"(
134+
const char kColorMapThermalPart[] = R"(
136135
colorscale: [
137136
['0.0', 'rgb(0,0,5)'],
138137
['0.2', 'rgb(12,0,44)'],
@@ -142,34 +141,33 @@ R"(
142141
['1.0', 'rgb(255,213,0)']
143142
],)";
144143

145-
146-
const char kColorMapGrayscalePart[] = R"(
144+
const char kColorMapGrayscalePart[] = R"(
147145
colorscale: [
148146
['0.0', 'rgb(0,0,0)'],
149147
['1.0', 'rgb(255, 255, 255)']
150148
],)";
151149

152-
const char kColorMapYlGnBuPart[] = R"(
150+
const char kColorMapYlGnBuPart[] = R"(
153151
colorscale: 'YlGnBu',
154152
)";
155153

156-
const char kColorMapJetPart[] = R"(
154+
const char kColorMapJetPart[] = R"(
157155
colorscale: 'Jet',
158156
)";
159157

160-
const char kColorMapHotPart[] = R"(
158+
const char kColorMapHotPart[] = R"(
161159
colorscale: 'Hot',
162160
)";
163161

164-
const char kColorMapElectricPart[] = R"(
162+
const char kColorMapElectricPart[] = R"(
165163
colorscale: 'Electric',
166164
)";
167165

168-
const char kColorMapPortlandPart[] = R"(
166+
const char kColorMapPortlandPart[] = R"(
169167
colorscale: 'Portland',
170168
)";
171169

172-
const char kHeatMapTypePart[] = R"(
170+
const char kHeatMapTypePart[] = R"(
173171
type: 'heatmap',
174172
hovertemplate: 'x:%{x} <br>y:%{y} <br>val:%{z:.}<extra></extra>',
175173
colorbar: {
@@ -313,8 +311,6 @@ For any questions please contact
313311
</html>
314312
)";
315313

316-
317-
318314
const char kNoFileFoundedPage[] = R"(<!DOCTYPE html>
319315
<html lang="ru">
320316
<head>
@@ -362,10 +358,8 @@ const char kNoFileFoundedPage[] = R"(<!DOCTYPE html>
362358
363359
)";
364360

365-
366-
const char kWarningIcon[] = R"davis_delimeter(<svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 156.262 144.407"><path d="M-109.166 7.227a2 2 0 0 0-.406.046c-3.195.03-6.176 1.695-7.785 4.483l-31.25 54.127-31.25 54.127h.002c-3.42 5.922 1.017 13.609 7.855 13.61h125.002c6.839-.001 11.277-7.688 7.857-13.61l-31.25-54.127-31.252-54.127c-1.465-2.539-4.079-4.164-6.978-4.45a2 2 0 0 0-.445-.077h-.004a2.006 2.006 0 0 0-.094-.002z" color="#000" style="solid-color:#000" transform="translate(186.615 2.437) scale(.99073)"/><path fill="#fff" d="M-109.165 9.227a7.081 7.081 0 0 0-6.46 3.529l-31.25 54.127-31.25 54.127c-2.674 4.631.777 10.609 6.126 10.61h125.002c5.348-.001 8.8-5.979 6.125-10.61l-31.25-54.127-31.252-54.127a7.079 7.079 0 0 0-5.79-3.53h-.001z" color="#000" style="solid-color:#000" transform="translate(186.615 2.437) scale(.99073)"/><path d="M-109.26 11.225a5.073 5.073 0 0 0-4.632 2.53l-31.25 54.128-31.25 54.127c-1.953 3.381.488 7.609 4.393 7.61h125.002c3.905-.001 6.345-4.229 4.392-7.61l-31.25-54.127-31.252-54.127a5.073 5.073 0 0 0-4.152-2.531z" color="#000" style="solid-color:#000" transform="translate(186.615 2.437) scale(.99073)"/><path fill="#fc0" d="M140.053 125.83H16.209L47.17 72.204l30.961-53.626 30.961 53.626z"/><g transform="translate(.295 2.437) scale(.99073)"><circle cx="78.564" cy="111.117" r="8.817"/><path d="M78.564 42.955a8.817 8.817 0 0 0-8.818 8.816l3.156 37.461a5.662 5.662 0 0 0 11.325 0l3.154-37.46a8.817 8.817 0 0 0-8.817-8.817z"/></g></svg>)davis_delimeter";
367-
368-
361+
const char kWarningIcon[] =
362+
R"davis_delimeter(<svg xmlns="http://www.w3.org/2000/svg" width="50%" height="50%" viewBox="0 0 156.262 144.407"><path d="M-109.166 7.227a2 2 0 0 0-.406.046c-3.195.03-6.176 1.695-7.785 4.483l-31.25 54.127-31.25 54.127h.002c-3.42 5.922 1.017 13.609 7.855 13.61h125.002c6.839-.001 11.277-7.688 7.857-13.61l-31.25-54.127-31.252-54.127c-1.465-2.539-4.079-4.164-6.978-4.45a2 2 0 0 0-.445-.077h-.004a2.006 2.006 0 0 0-.094-.002z" color="#000" style="solid-color:#000" transform="translate(186.615 2.437) scale(.99073)"/><path fill="#fff" d="M-109.165 9.227a7.081 7.081 0 0 0-6.46 3.529l-31.25 54.127-31.25 54.127c-2.674 4.631.777 10.609 6.126 10.61h125.002c5.348-.001 8.8-5.979 6.125-10.61l-31.25-54.127-31.252-54.127a7.079 7.079 0 0 0-5.79-3.53h-.001z" color="#000" style="solid-color:#000" transform="translate(186.615 2.437) scale(.99073)"/><path d="M-109.26 11.225a5.073 5.073 0 0 0-4.632 2.53l-31.25 54.128-31.25 54.127c-1.953 3.381.488 7.609 4.393 7.61h125.002c3.905-.001 6.345-4.229 4.392-7.61l-31.25-54.127-31.252-54.127a5.073 5.073 0 0 0-4.152-2.531z" color="#000" style="solid-color:#000" transform="translate(186.615 2.437) scale(.99073)"/><path fill="#fc0" d="M140.053 125.83H16.209L47.17 72.204l30.961-53.626 30.961 53.626z"/><g transform="translate(.295 2.437) scale(.99073)"><circle cx="78.564" cy="111.117" r="8.817"/><path d="M78.564 42.955a8.817 8.817 0 0 0-8.818 8.816l3.156 37.461a5.662 5.662 0 0 0 11.325 0l3.154-37.46a8.817 8.817 0 0 0-8.817-8.817z"/></g></svg>)davis_delimeter";
369363

370364
const char kHtmlDateTimeModel[] = R"davis_delimeter(
371365
<head>
@@ -392,6 +386,32 @@ var data = [
392386
%2
393387
];
394388
%9
389+
var layout = {
390+
title: {
391+
text:''
392+
},
393+
xaxis: {
394+
title: {
395+
text: 'X'
396+
},
397+
},
398+
yaxis: {
399+
title: {
400+
text: 'Y'
401+
}
402+
},
403+
scene: {
404+
xaxis: {
405+
title: 'X',
406+
},
407+
yaxis: {
408+
title: 'Y',
409+
},
410+
zaxis: {
411+
title: '',
412+
}
413+
}
414+
};
395415
var config = {
396416
editable: true,
397417
showLink: true,
@@ -404,8 +424,6 @@ Plotly.newPlot('gd', data, layout, config);
404424
</body>
405425
)davis_delimeter";
406426

407-
408-
409427
const char kHtmlMultiChartBlock[] = R"davis_delimeter(
410428
var trace%1 = {
411429
x: [%2],
@@ -415,9 +433,6 @@ var trace%1 = {
415433
};
416434
)davis_delimeter";
417435

418-
419-
420-
421436
const char kHtmlMultiChartModel[] = R"davis_delimeter(
422437
<head>
423438
<script src="%1" charset="utf-8"></script>
@@ -482,8 +497,6 @@ Plotly.newPlot('gd', data, layout, config);
482497
</body>
483498
)davis_delimeter";
484499

485-
486-
487500
const char kHtmlCloudOfPoints[] = R"davis_delimeter(
488501
489502
<head>
@@ -523,13 +536,12 @@ Plotly.newPlot('gd', data,layout,config);
523536
524537
)davis_delimeter";
525538

526-
const char kHtmlSimpleDataBlock[]= R"davis_delimeter({
539+
const char kHtmlSimpleDataBlock[] = R"davis_delimeter({
527540
x: [%1],
528541
y: [%2],
529542
mode: 'lines'
530543
})davis_delimeter";
531544

532-
533545
const char kHtmlComboboxStyleBlock[] = R"davis_delimeter(
534546
<style>
535547
#dropdown {
@@ -558,15 +570,14 @@ const char kHtmlComboboxStyleBlock[] = R"davis_delimeter(
558570
</style>
559571
)davis_delimeter";
560572

561-
const char kHtmlComboboxSelectBlock[] =R"davis_delimeter(
573+
const char kHtmlComboboxSelectBlock[] = R"davis_delimeter(
562574
<select id="dropdown" onchange="updateBackground(this)">
563575
<option value="image1" data-image="<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 171.373 11.261'><path d='M0 0h171.373v11.261H0z'/></svg>">line</option>
564576
<option value="image2" data-image="<svg width='100' height='100' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 171.373 50'><g transform='translate(-20.762 -48.999)'><path d='M20.762 68.268h171.373v11.261H20.762z'/><circle cx='107.49' cy='73.999' r='25'/></g></svg>">line + point</option>
565577
<option value="3.svg" data-image="<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 171.373 50'><circle cx='107.49' cy='73.999' r='25' transform='translate(-20.762 -48.999)'/></svg>">point</option>
566578
</select>
567579
)davis_delimeter";
568580

569-
570581
const char kHtmlComboboxUpdateFooBlock[] = R"davis_delimeter(
571582
function updateBackground(select) {
572583
var selectedImage = select.options[select.selectedIndex].getAttribute('data-image');
@@ -596,15 +607,14 @@ function updateBackground(select) {
596607
});
597608
)davis_delimeter";
598609

599-
600-
const char kHtmlComboboxSelectSurfaceMatrixBlock[]=R"davis_delimeter(
610+
const char kHtmlComboboxSelectSurfaceMatrixBlock[] = R"davis_delimeter(
601611
<select id="dropdown" onchange="updateBackground(this)">
602612
<option value="matrix_image" data-image="<?xml version='1.0' encoding='UTF-8' standalone='no'?><!-- Created with Inkscape (http://www.inkscape.org/) --><svg width='60mm' height='60mm' viewBox='0 0 60 60' version='1.1' id='svg1' inkscape:export-filename='matrix.svg' inkscape:export-xdpi='96' inkscape:export-ydpi='96' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'> <sodipodi:namedview id='namedview1' pagecolor='#ffffff' bordercolor='#000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='#d1d1d1' inkscape:document-units='mm' inkscape:zoom='0.73139029' inkscape:cx='118.26791' inkscape:cy='428.63571' inkscape:window-width='1920' inkscape:window-height='1017' inkscape:window-x='1912' inkscape:window-y='-8' inkscape:window-maximized='1' inkscape:current-layer='layer1' /> <defs id='defs1' /> <g inkscape:label='Слой 1' inkscape:groupmode='layer' id='layer1'> <rect style='fill:#ff2a2a;stroke-width:0.264583' id='rect1' width='30' height='30' x='0' y='0' /> <rect style='fill:#ffff00;stroke-width:0.264583' id='rect2' width='30' height='30' x='30' y='0' /> <rect style='fill:#ff00ff;stroke-width:0.264583' id='rect3' width='30' height='30' x='30' y='30' /> <rect style='fill:#00ffff;stroke-width:0.264583' id='rect4' width='30' height='30' x='0' y='30' /> </g></svg>">matrix</option>
603613
<option value="surface_image" data-image="<?xml version='1.0' encoding='UTF-8' standalone='no'?><!-- Created with Inkscape (http://www.inkscape.org/) --><svg width='48.685608mm' height='57.444851mm' viewBox='0 0 48.685608 57.444851' version='1.1' id='svg1' inkscape:export-filename='matrix.svg' inkscape:export-xdpi='96' inkscape:export-ydpi='96' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'> <sodipodi:namedview id='namedview1' pagecolor='#ffffff' bordercolor='#000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='#d1d1d1' inkscape:document-units='mm' inkscape:zoom='0.73139029' inkscape:cx='118.26791' inkscape:cy='428.63571' inkscape:window-width='1920' inkscape:window-height='1017' inkscape:window-x='1912' inkscape:window-y='-8' inkscape:window-maximized='1' inkscape:current-layer='layer1' /> <defs id='defs1' /> <g inkscape:label='Слой 1' inkscape:groupmode='layer' id='layer1' transform='translate(-5.1280656,-1.0459301)'> <path style='fill:#0099ff;fill-opacity:1;stroke-width:0.264583' d='M 15.257176,8.9730377 5.1280653,39.450809 24.934094,46.052817 Z' id='path8' /> <path style='fill:#0099ff;fill-opacity:1;stroke-width:0.264583' d='M 39.107412,1.0459301 21.435214,27.86359 38.857644,39.366818 Z' id='path12' /> <path style='fill:#00d3ff;fill-opacity:1;stroke-width:0.264583' d='M 15.259243,8.9749767 33.254436,35.200199 24.753217,45.962379 Z' id='path9' sodipodi:nodetypes='cccc' /> <path style='fill:#00d3ff;fill-opacity:1;stroke-width:0.264583' d='m 39.108907,1.048338 10.594434,29.989119 -10.997004,8.19519 z' id='path13' sodipodi:nodetypes='cccc' /> <path style='fill:#0099ff;fill-opacity:1;stroke-width:0.264583' d='m 53.813674,29.791115 -31.459079,6.466818 4.185507,20.453528 z' id='path10' /> <path style='fill:#00d3ff;fill-opacity:1;stroke-width:0.264583' d='M 53.813028,29.793875 40.098917,58.49078 26.527985,56.509598 Z' id='path11' sodipodi:nodetypes='cccc' /> </g></svg>">surface</option>
604614
</select>
605615
)davis_delimeter";
606616

607-
const char kHtmlComboboxUpdateSurfaceMatrixFooBlock[]=R"davis_delimeter(
617+
const char kHtmlComboboxUpdateSurfaceMatrixFooBlock[] = R"davis_delimeter(
608618
function updateBackground(select) {
609619
var selectedImage = select.options[select.selectedIndex].getAttribute('data-image');
610620
select.style.backgroundImage = 'url("data:image/svg+xml,' + encodeURIComponent(selectedImage) + '")';
@@ -704,7 +714,6 @@ extern const char kHtmlDavisLogoHyperlinkBlock[] = R"davis_delimeter(
704714
</a>
705715
)davis_delimeter";
706716

707-
708717
const char kAverageButtonStyleBlock[] = R"davis_delimeter(
709718
<style>
710719
.toggle-button {
@@ -745,7 +754,6 @@ const char kAverageButtonDivBlock[] = R"davis_delimeter(
745754
<div class="state-text" id="stateText">Average: OFF</div>
746755
)davis_delimeter";
747756

748-
749757
const char kAverageButtonJsFooBlock[] = R"davis_delimeter(
750758
const toggleButton = document.getElementById('toggleButton');
751759
const stateText = document.getElementById('stateText');
@@ -760,7 +768,6 @@ const char kAverageButtonJsFooBlock[] = R"davis_delimeter(
760768
});
761769
)davis_delimeter";
762770

763-
764771
const char kAverageErrorDataBlock[] = R"davis_delimeter({
765772
x: [%1],
766773
y: [%2],

0 commit comments

Comments
 (0)