U++ framework
Do not panic. Ask here before giving up.

Home » Community » Newbie corner » How do I make this graph?
Re: How do I make this graph? [message #39835 is a reply to message #39829] Sun, 05 May 2013 15:57 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3461
Registered: August 2008
Senior Veteran
Hello Jerson

I imagine the X and Y axis are rather "custom" so I propose you this to have exactly what you want:

index.php?t=getfile&id=4169&private=0

This is the code:

void MyClass::Init() {
	CtrlLayout(*this);	
	HSizePos().VSizePos();
	
	scatter.SetRange(12, 130);
	scatter.SetXYMin(0, -120);
	scatter.SetMajorUnits(1, 10);
	scatter.ShowLegend(false);
	scatter.SetTitle("Right Ear").SetLabelX("X-Axis").SetLabelY("dB");
	scatter.SetPlotAreaLeftMargin(40).SetPlotAreaBottomMargin(40);
	
	s1 <<Pointf(4, -30) << Pointf(6, -35) << Pointf(10, -50);
	s2 <<Pointf(4, -55) << Pointf(6, -60) << Pointf(10, -70);
	
	scatter.AddSeries(s1);
	scatter.AddSeries(s2);
	
	scatter.cbModifFormatX = THISBACK(FormatX);
	scatter.cbModifFormatY = THISBACK(FormatY);
}

void MyClass::FormatX(String& s, int i, double d) {
	Vector<String> xLegend;
	xLegend << "125" << "250" << "500" << "750" << "1K" << "1.5K" << "2K" << "3K" << "4K" << "6K" << "8K" << "10K" << "12K";
	s = xLegend[i];
}

void MyClass::FormatY(String& s, int i, double d) {
	s = FormatDouble(-d, 0);
}


Have a nice Sunday! Smile
  • Attachment: Image.png
    (Size: 10.50KB, Downloaded 1039 times)


Best regards
IƱaki
 
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
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MenuBar
Next Topic: SQL + vector related question
Goto Forum:
  


Current Time: Fri Jul 31 08:28:36 GMT+2 2026

Total time taken to generate the page: 0.00636 seconds