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 #56140 is a reply to message #56135] Sun, 31 January 2021 14:37 Go to previous messageGo to previous message
Maginor is currently offline  Maginor
Messages: 44
Registered: May 2019
Member
If you don't settle on having gaps in the line as a default, it would be very good to have it as an option. As I said, I rely on that in my application.

I have attached the data as a csv. Note that it is around 10'000 lines, and only the last 2/3 of the indexes have y-data in them. The ones that don't have any y-data should be given a y value of Null when you parse them.

You can parse it using something like the below (Sorry for not being upp idiomatic)

std::vector<double> xs, ys;

std::ifstream infile("data.csv");

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

Plot.AddSeries(xs.data(), ys.data(), xs.size());
  • Attachment: data.csv
    (Size: 205.04KB, Downloaded 132 times)
 
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: Fri Apr 26 07:00:38 CEST 2024

Total time taken to generate the page: 0.03737 seconds