Home » U++ Library support » ScatterDraw & ScatterCtrl » Entirely Null series is drawn as a random constant line
Re: Entirely Null series is drawn as a random constant line [message #56172 is a reply to message #56108] |
Wed, 03 February 2021 11:02 |
Maginor
Messages: 44 Registered: May 2019
|
Member |
|
|
Hi, sorry. I did not want to post my main code here since it is pretty entangled. I did not have time to produce a separate bug reproduction before now:
The styling on the line is not essential.
Compiled using Clang64 on Windows.
Using the 2021-02-02 nightly build.
The image is what it looks like when you zoom in using the mouse wheel.
ScatterCtrlTest.lay:
LAYOUT(ScatterCtrlTestLayout, 916, 488)
ITEM(Upp::ScatterCtrl, Plot, HSizePosZ(4, 4).VSizePosZ(4, 4))
END_LAYOUT
ScatterCtrlTest.h:
#ifndef _ScatterCtrlTest_ScatterCtrlTest_h
#define _ScatterCtrlTest_ScatterCtrlTest_h
#include <CtrlLib/CtrlLib.h>
#include <ScatterCtrl/ScatterCtrl.h>
using namespace Upp;
#define LAYOUTFILE <ScatterCtrlTest/ScatterCtrlTest.lay>
#include <CtrlCore/lay.h>
class ScatterCtrlTest : public WithScatterCtrlTestLayout<TopWindow> {
public:
ScatterCtrlTest();
std::vector<double> xs, ys;
};
#endif
ScatterCtrlTest.cpp:
#include "ScatterCtrlTest.h"
#include <fstream>
ScatterCtrlTest::ScatterCtrlTest()
{
CtrlLayout(*this, "Window title");
Plot.SetFastViewX(true);
Plot.SetSequentialXAll(true);
std::ifstream infile("data.csv");
if(!infile) PromptOK("Failed opening file");
std::string line;
std::getline(infile, line); //ignore first line
while (std::getline(infile, line))
{
std::istringstream iss(line);
double x, y;
char c;
if (iss >> x)
{ xs.push_back(x); }
else break;
iss >> c; //eat the semicolon
if(iss >> y)
{ ys.push_back(y); }
else ys.push_back(Null);
}
infile.close();
Color GraphColor(0, 130, 200);
Plot.AddSeries(xs.data(), ys.data(), xs.size()).NoMark().Stroke(1.5, GraphColor).Dash("");
Plot.ZoomToFit();
Plot.Refresh();
}
GUI_APP_MAIN
{
ScatterCtrlTest().Run();
}
|
|
|
|
|
Entirely Null series is drawn as a random constant line
By: Maginor on Wed, 27 January 2021 14:12
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: koldo on Thu, 28 January 2021 09:23
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: Maginor on Fri, 29 January 2021 13:53
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: koldo on Sun, 31 January 2021 09:52
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: Maginor on Sun, 31 January 2021 14:37
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: koldo on Mon, 01 February 2021 11:21
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: Maginor on Tue, 02 February 2021 10:29
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: koldo on Tue, 02 February 2021 18:15
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: koldo on Tue, 02 February 2021 19:12
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: Maginor on Wed, 03 February 2021 11:02
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: koldo on Wed, 03 February 2021 12:41
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: Maginor on Mon, 15 February 2021 10:10
|
|
|
Re: Entirely Null series is drawn as a random constant line
By: koldo on Mon, 15 February 2021 18:04
|
Goto Forum:
Current Time: Thu Apr 25 21:10:14 CEST 2024
Total time taken to generate the page: 0.03688 seconds
|