Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
Maginor is currently offline  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.
index.php?t=getfile&id=6369&private=0


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();
}

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ScatterDraw::ExplicitRange
Next Topic: CtrlLib and ScatterDraw Layout Error.
Goto Forum:
  


Current Time: Thu Apr 25 21:10:14 CEST 2024

Total time taken to generate the page: 0.03688 seconds