From b60d3bfa07bad55d037932dcc303169333fc509b Mon Sep 17 00:00:00 2001 From: koldo Date: Tue, 18 May 2010 20:47:31 +0000 Subject: [PATCH] Scatter: Added SetSequentialX and SetFastViewX git-svn-id: svn://ultimatepp.org/upp/trunk@2408 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/Scatter/Chart.usc | 2 + bazaar/Scatter/Scatter.cpp | 133 +++++++++++++----- bazaar/Scatter/Scatter.h | 9 ++ .../Scatter/srcdoc.tpp/TestScatter2$en-us.tpp | 121 ++++++++++++++++ 4 files changed, 231 insertions(+), 34 deletions(-) diff --git a/bazaar/Scatter/Chart.usc b/bazaar/Scatter/Chart.usc index 66a8b8cd5..ee6cb84fe 100644 --- a/bazaar/Scatter/Chart.usc +++ b/bazaar/Scatter/Chart.usc @@ -24,6 +24,8 @@ ctrl Scatter { bool ShowVGrid=true; bool ShowLegend=true; int SetLegendWeight=80; + bool SetFastViewX=false; + bool SetSequentialXAll=false; Paint(w) { r = GetRect(); diff --git a/bazaar/Scatter/Scatter.cpp b/bazaar/Scatter/Scatter.cpp index a5b10e9f4..71e2cc85d 100644 --- a/bazaar/Scatter/Scatter.cpp +++ b/bazaar/Scatter/Scatter.cpp @@ -398,6 +398,7 @@ Scatter &Scatter::AddSeries(Vector & points,const String& legend,const bool& vShowMark.Add(true); vMarkStyles.Add(CIRCLE); vPPrimaryY.Add(true); + vPSequential.Add(sequentialXAll); vPPattern.Add(LINE_SOLID); Refresh(); @@ -652,6 +653,29 @@ bool Scatter::IsDataPrimaryY(const int& j) const throw (Exc) return vPPrimaryY[j]; } +void Scatter::SetSequentialX(const int& j, const bool& sequential) +{ + if(IsValid(j)) + { + vPSequential[j]=sequential; + Refresh(); + } +} + +Scatter &Scatter::SetSequentialX(const bool& sequential) +{ + SetSequentialX(vPSequential.GetCount()-1, sequential); + return *this; +} + +Scatter &Scatter::SetSequentialXAll(const bool& sequential) +{ + for (int i = 0; i < vPSequential.GetCount(); ++i) + SetSequentialX(i, sequential); + sequentialXAll = sequential; + return *this; +} + void Scatter::SetFunctPrimaryY(const int& j, const bool& primary) { if(IsValid(j)) @@ -690,6 +714,7 @@ void Scatter::RemoveSeries(const int& j) vMarkStyles.Remove(j); vPPrimaryY.Remove(j); vPPattern.Remove(j); + vPSequential.Remove(j); Refresh(); } @@ -708,6 +733,7 @@ void Scatter::RemoveAllSeries() vShowMark.Clear(); vMarkStyles.Clear(); vPPrimaryY.Clear(); + vPSequential.Clear(); vPPattern.Clear(); Refresh(); @@ -1206,42 +1232,81 @@ void Scatter::Plot(Draw& w, const int& scale,const int& l,const int& h)const int ix;//int x points coordinates int iy;//int y points coordinates if (!vPointsData.IsEmpty()){ - for (int j=0; j p1; - for (int i=0; i2) - { - Vector p2; - Vector v(Cubic(vPointsData[j])); - for (int i=0; i p1; + int imin, imax; + if (vPSequential[j]) { + imin = imax = Null; + for (int i = 1; i= xMin) + imin = i-1; + } else if (IsNull(imax)) { + if (vPointsData[j][i].x >= xMin+xRange) + imax = i+1; + } } - if(!p2.IsEmpty()) DrawPolylineX(w, p2,fround(scale*vPThickness[j]/6),vPColors[j],vPPattern[j], scale); + if (IsNull(imin)) + imin = 0; + if (IsNull(imax)) + imax = vPointsData[j].GetCount(); + } else { + imin = 0; + imax = vPointsData[j].GetCount(); } - - else if (!p1.IsEmpty()) DrawPolylineX(w, p1,fround(scale*vPThickness[j]/6),vPColors[j],vPPattern[j], scale); - } - - if(vShowMark[j]) - for (int i=0; i2) + { + Vector p2; + Vector v(Cubic(vPointsData[j])); + for (int i=0; i & points); @@ -187,6 +191,8 @@ public: Scatter& SetMinZoom(double x, double y = -1) {minXZoom = x; minYZoom = y; return *this;}; Scatter& SetMaxZoom(double x, double y = -1) {maxXZoom = x; maxYZoom = y; return *this;}; + Scatter& SetFastViewX(bool set = true) {fastViewX = set; return *this;}; + private: class ::Color graphColor; String title; @@ -200,6 +206,8 @@ private: int px, py; class ::Color plotAreaColor; + bool fastViewX, sequentialXAll; + bool paintInfo; Point clickPoint; PopUpInfo popText; @@ -226,6 +234,7 @@ private: Vector > vPointsData,vFunctionData; Vector vFPrimaryY, vPPrimaryY; + Vector /*vFSequential, */vPSequential; Vector vFPattern, vPPattern; typedef double (*fAdress)(double); Vector vAdress; diff --git a/bazaar/Scatter/srcdoc.tpp/TestScatter2$en-us.tpp b/bazaar/Scatter/srcdoc.tpp/TestScatter2$en-us.tpp index e886a381c..5b57891ea 100644 --- a/bazaar/Scatter/srcdoc.tpp/TestScatter2$en-us.tpp +++ b/bazaar/Scatter/srcdoc.tpp/TestScatter2$en-us.tpp @@ -3772,5 +3772,126 @@ to zoom and move the graphs in X and Y axis.]] 䜺֜ƻ硡ώر⅝򀹇ì۷ܸ񣑧™ ߜ𝵲֬ٲ쬶ˋýˋ +]]}}&] +[s0; &] +[s0; &] +[s0;i150;O0; [*2 Big datasets]&] +[s0;2%- &] +[ {{4548:5452f0;g0;^ [s0; [2 Big datasets are hard to handle. However there are two functions +that speed up dramatically Scatter response in X axis sequential +datasets like time series:]&] +[s0;2 &] +[s0;i150;O0; [2 SetSequentialX: Indicates that the data has been sequentially +inserted following X axis]&] +[s0;i150;O0; [2 SetFastViewX: Indicates that it will be viewed a point +per horizontal pixel. This point will be the average of all data +that is in that pixel]&] +[s0;2 ] +::= [s0;= [*R2 +@@image:1903&1167 +흽۔Ŧ苿펫کիş鹿á +Ȁ񀀀޾շ䂀怨민 +󷾛ڷLJϜǏǟϠڞ +۷ߍ́߿׿ØԽΥǟ +㞓叞쀀܀ܮѳϗϒ̏ߖǼժځ +Կǟെօڀ߲מ㿈 +߉ؿг۽՘ϊ߿ͱ휧 +ޟڲʛ̀ߌ݀ +БɯҟǑ +ǿڇѲތ߇󬱔盃简ܫ͖ +ӾΓ̫ٚǩżྉ޾蹺ڎ٤ +ҧۣ˿׿瑀򟀀 +ӬƱǿʐljč +Ȑņؾ馐̂ӺϦ׎‚Ѣ +ʌƊ֦ۉꥤ‘µͪλ +ـŶƒĴĆ؃ɑȇܱÐБ̑º +Тޗݓجأΐ̸ʑŝԔȌΐ̨ĕ +ġ躅舲Ӣáџُ֔ԙ΍ᅴḀ +ۖჄ׍菅֍ʃܾɲ֠׍Ϣᾲ +Öê嶂ܥɖ݌挊Ðȡ́Ø +Ԉ؄˸«˹؟ȠۅƳ먓Ȭ +䊘Ґ䌦̄ر谎эʪʨɟكؙ뜹̆㔘岪 +ߏῼ޻˜ᤄ޽՗̉ +̰ݝĐޏگɥ݋٦襫Ӛۂ +իӉشڶͶĸ縤ŕ򿩋ϔڎ謻 +ổdž߮Ճѵ޶Ӛ並ƛέ߱ +ߨп׸ϡСρԉ𯭉 +éጥےָ๋ۧڷ܈ӕ +҉Կձ뷝ٍԦŐħԸϺª忄 +ׇͦ޲ݭð涄Đڨ +느ʙ岅㥑ҺȢʢÐᙩ‰ؔݓυ +ŞΌ؉ȓȧ򹃠ӕʜÐް +̗搢Ӏ蓧󑚑俻І +ƿۃぐݎǩŰө؋ȓٱȦΑވ +ʌČťĶƹ݃‚⹅͈Ō𨾐躐 +ܪ݈ʊÁ؞ڭы俌צ +⊀Ƣȥ҆ɻ𗱤ۇ淄𞥱Ϫ֘ +ھߩˏѷǁց볋٠Ɖī∲İ +Σ񞑸ʕԮ̂ۃζ臯Ȕ +÷ԇɋĐĪϞԑĐĨ +ҕ尅俭򰟶ɭ˙ݰξ쇯ܢ⛉؞ +̞ݭéºѨĐ䜩ȢǕԪÐĵ +ČэՂ̵醖ť∲ +ԙȎϕңƷӝǞ򔜂깮Êң +ȎȔܯЭ엽¿ߏ옸ۛ؆и +ТƋ̮貘⮸̥dzǍݸ +϶ΰ␄볝ƶʸěӚٙΗꔌȎ +Ö꾺ёȎƆј͐ +¯劐񣷵Ɉ쾮҃󥉘ǐȖ삤 +ΙûУ՞ǁƆŻκγاᶮܰӆꐱῼɕ +ܑƖ㛒ʮߊǤ́ԤΛώ +ĊЅ󕎔抓˂ɥ׮Ć崝Čᙱȉʼnȏ +跅ᥫՒƣč뒑ڝɨӜ蝑򖤬ۓ +΁ÞЪǀŶՠҫɑ❼ǔѤߊר +߾໲ٚݮޱǕǀ׌ְܾ֩Ⱦ˪祤٨Ӏʤ +ݨ˭́ߝӃғƟ +Ƥ↎ǀ崋΍£ϰ⿆߂ב҅ς +艸䥃ϕۧհБҩƼԟȀ򦿞ޣֺ +̱ЁǑ̝ܘҋ߃޲ʶüͷņ +™ř޻큣֝˶ػޖ֢ף˩ޒڋ̐ +ȥ診ʙɸ끫↎ȢƯҚ +Ӏ۾ҳͲۡ䉋ڂۅ΁ϮӦ֕ٲ +ӹԊלĀԌϙ慵ۇڷɍ +⊨پѫٴ֨֟ܛُݠ߉ٔ +򆏂̮סû翕Ēᡙ൅ڰٜꟄո»Օ +˴Ѹңԙ힆Úɨ߽ǐŌɕö閤닲þ +ꩀłŲȒԥԋ޷᭥͑׳˷ҩʊ +Ԫ䴤܈ȧԨѱ̩Ӑݭҩʃ뾂 +ߴԬۛ桛́ҥׅȦƬޒȴ윑IJʦ⯝ҩʲ +IJț訑忆ϙҳӤÔۿ֣ +јǀȽӃ왺ǿ́߇ηݖ崞 +ًʤͤܚӾ˒Ӏپֺ뛻텳 +盉ԙ힘ʻˤþȥ͢ +ɖԚ³ӇѬΌȱ儔ȝɘ +ם̆ԝڙƧĆۜʠ磅 +ߑɡ͌䌗ҩʶܖšƨș +詺ֲȃ˥丽􊎒ɠٔОԌ +Ռ؃Ƨ滊зȞ帄訹Љ؆밑 +Ȟ⋵锝ܦȘȕퟑΑѢ뀏߽ +Ŀ̝ɷЎҷ +㏻ʤ¯ָݧˣں݈חЍÎըÝׂ +ӤʝЍ۝ݚ䙊Ȋ +ٖɀ恛Ö˝ˡɉ̍ݧ +ʜ丅ӆݖ㯾̆ɥً俜 +Ȃݲ슃ࡣ̳τԩþ⢈藪߬讼 +愈ġҘ̄ΤŌ̊ުâ׷Ʀأե俄ܹɆ⏑ +ܳɱߏࡣђƍݓש轅ڞٳ +ݷĆÍ☈ЭݘɰˡƦʍ +忏朦ٰޜ߯ɿܲ䛈ꙣܚӾڋ +ږȳ۲ݸƃݧ鱣˿ +Ü܁ʠٔÆצʚՈhͥɨÑ╴ +ԲȔ҉ؐզ񼿌Ϥ +Ȏܸ̠䨔㯤κꗔ誙 +º鮤à˙ԝЭŧ俛ًŞ𐡩򙗱럴ʃn +듹ȟͥȈڤ޲нҠ +μظݔУȸゆԀô +𯱸Ȩƚ؞ʐƉ֐тƚʐ +䀀ɑʶŔԉ˴ȶ̏˸ҩǙୡ揵ڗ +Ցӥίڷ輼؉ˌ圞эإ +ĞޜȲΙɑݭ +ђď޼Ǎˋّ޸㌽Ąڷ虆ƧñƲܐ +⠦ˍ̇ᨣ湖ׁ̋ߑؐ̿ +ۯᣣƙ +񓫚 ]]}}&] [s0; ] \ No newline at end of file