Difference between revisions of "TrackingDiagram"

From Catglobe Wiki
Jump to: navigation, search
Line 26: Line 26:
 
== Detail design  ==
 
== Detail design  ==
  
'''1. '''<u>'''To refactor the generalization:'''</u><br>  
+
<span style="color: rgb(0, 0, 255);">'''1. '''<u>'''Refactor the generalization:'''</u></span><u></u><br>  
  
 
'''Diagram:'''<br>  
 
'''Diagram:'''<br>  
Line 41: Line 41:
  
 
*Chart is auto-generate initialized or not<br>  
 
*Chart is auto-generate initialized or not<br>  
*Chart is initialized with criteria hidden or not<br>
+
*Chart is initialized with criteria hidden or not<br>  
 +
*Others
  
 
<br>  
 
<br>  
Line 50: Line 51:
  
 
*Chart is generated with one more Trend-line or not  
 
*Chart is generated with one more Trend-line or not  
*Chart is generated with style of each series (brand) applied by their order or not
+
*Chart is generated with style of each series (brand) applied by their order or not  
 +
*Others
  
 
<br>  
 
<br>  
  
'''2. '''<u>'''Create new TrackingDiagramInfo:'''</u><br>  
+
'''AbstractCrossDiagramTester:'''
 +
 
 +
Common methods have been moved out to general AbstractDiagramTester, but not erased yet to assure its stability
 +
 
 +
<span style="color: rgb(0, 0, 255);">
 +
</span>
 +
 
 +
<span style="color: rgb(0, 0, 255);">'''2. '''<u>'''Create new TrackingDiagramInfo:'''</u></span><u></u><br>  
  
 
[[Image:TrackingDiagramInfo.png]]<br>  
 
[[Image:TrackingDiagramInfo.png]]<br>  
Line 60: Line 69:
 
<br>  
 
<br>  
  
'''TrackingDiagramInfo''' contains a DynamicExpressionResolver 2-D array (which each element is a brand item value)
+
'''TrackingDiagramInfo''' contains a DynamicExpressionResolver 2-D array (which each element is a brand item value  
 +
 
 +
 
  
 
'''DynamicExpressionResolver&nbsp;:'''  
 
'''DynamicExpressionResolver&nbsp;:'''  
Line 66: Line 77:
 
<u>''Purpose to exist:''</u>  
 
<u>''Purpose to exist:''</u>  
  
 +
*Not alike Cross diagram, Tracking diagram has expressions of branches exists independently from each other and might be set more complicated than short math-base axis set expressions of Cross diagram. Also for its filters (common filters of Filters node inside Tracking diagram editor).
 
*Assure the flexibility of brand item value. Tracking diagram hasn't got concrete Axis object like Cross, just values of brand item as expressions. Expression might be realized as DynamicExpressionResolver in short format (filter format) like&nbsp;:&nbsp;Q1 == [1] or, in full format like&nbsp;: count() where Q1 == [1]  
 
*Assure the flexibility of brand item value. Tracking diagram hasn't got concrete Axis object like Cross, just values of brand item as expressions. Expression might be realized as DynamicExpressionResolver in short format (filter format) like&nbsp;:&nbsp;Q1 == [1] or, in full format like&nbsp;: count() where Q1 == [1]  
 
*Handle validity of brand item value better (might be used in further Tracking/Campaign editor rebuilding)
 
*Handle validity of brand item value better (might be used in further Tracking/Campaign editor rebuilding)
Line 74: Line 86:
 
*Not full format (count() where Q1==1)<br>  
 
*Not full format (count() where Q1==1)<br>  
 
*Full format (=count() where Q1==1;)<br>  
 
*Full format (=count() where Q1==1;)<br>  
*Complex expression (={&nbsp; var x=1; var y=1; ...; return (x+y);})<br>
+
*Complex expression (={&nbsp; var x=1; var y=1; ...; return (x+y);}) (Not full yet)<br>
  
 
<u></u>''<u>Limitation:</u>''<br>  
 
<u></u>''<u>Limitation:</u>''<br>  
  
DynamicExpressionResolver hasn't support fully for cgscript (refer older engine's and FilterInfo's also). For example, user don't input as usual, but a cgscript function (like in Spreadsheet&nbsp;:&nbsp;= {&nbsp; var sht...&nbsp;; return sht; }, then our current filter-appending-in-last bussiness can dive into a rock when generated expression will be&nbsp;:&nbsp;= { var sht...&nbsp;; return sht } &amp;&amp; Q1==[1].<br>  
+
DynamicExpressionResolver hasn't support fully for CGScript (refer older engine's and FilterInfo's also). For example, user don't input as usual, but a cgscript function (like in Spreadsheet&nbsp;:&nbsp;= {&nbsp; var sht...&nbsp;; return sht; }, then our current filter-appending-in-last bussiness can dive into a rock when generated expression will be&nbsp;:&nbsp;= { var sht...&nbsp;; return sht } &amp;&amp; Q1==[1].<br>  
  
 
Solution might be use functions alike in Interpreter (where expression is parsed, get condition, math enumarator from AST etc.), or these existing Interpreter's functions would be set public.  
 
Solution might be use functions alike in Interpreter (where expression is parsed, get condition, math enumarator from AST etc.), or these existing Interpreter's functions would be set public.  
Line 84: Line 96:
 
<u></u><br>  
 
<u></u><br>  
  
'''3. '''<u>'''Unit test'''</u><br>  
+
<span style="color: rgb(0, 0, 255);">'''3. '''<u>'''Unit test'''</u></span><u></u><br>
 +
 
 +
[[Image:TrackingDiagramInfo_UnitTest.png]]<br>
 +
 
 +
*Templates contains svgs of 2 simplest cases generated:
 +
 
 +
#From an one-levelled branch to one series
 +
#From 2 one-levelled branches to 2 series<br>
  
<br>
+
*AbstractDiagramTester : Also ready to be used for AbstractCrossDiagramTester<br>
 +
*AbstractTrackingDiagramTester has virtual initializing function contains data cache data for case "from an one-levelled branch to one series" which may be overriden in other &amp; further cases<br>
  
 
== Document revisions  ==
 
== Document revisions  ==

Revision as of 09:09, 1 February 2010

New Report Design - 2009 => TrackingDiagram

Introduction

This page is detail design for detail implementation of tracking diagram, both on GUI and Business layers.

First feeling:

  1. There are lots of setting on GUI makes us feel that this diagram is not close to cross diagram, however basically the only different is in phase 1 (DataSeries generation), the remaining are nearly the same.
  2. Data cache must have StartDate and EndDate column to be used with tracking diagram
  3. Diagram's XML must be used (it is optional in CrossDiagram)
  4. There are 2 parts: static part (defined in XML - list of branches, list of target group, timeset, etc.), dynamic part (defined on GUI - which brand to draw on, values of target group, trend line, time period, etc.) => dynamic part MUST be saved for future requests
  5. Formulas are PRE-DEFINED by end user
  6. Time periods and target groups in fact are additional filters
  7. Trend line is just another data series to draw

Design decisions

GUI:

  • Split into user controls with MVP implementation => must have some unit test for this
  • Support skin => default skin is just like the default one of CrossDiagram

XML:

  • We focus on the viewer part instead of editing part => reuse the old XML format, however there must be an FORMAT ADAPTOR that is capable of parsing both old and new (might be defined later) format

Business:

  • TrackingDiagramInfo has the same role as CrossDiagramInfo for cross diagram

Detail design

1. Refactor the generalization:

Diagram:

New virtual method DataSeries[][] BuildData(DiagramInfo diagramInfo) (moved onto from CrossDiagram originally)

New property called Calculator (type ICalculator) will be initialized whenever method BuildData is called


DiagramInfo:

New properties called SelfDefinedCriterias, containing the self-defined criterias (this assures other own criteria of further chart like : Cross, Campaign etc.). The properties should be initialized inside constructors of each chart whenever it needs to be used. In current scenario, it has just supported for Tracking with:

  • Chart is auto-generate initialized or not
  • Chart is initialized with criteria hidden or not
  • Others


ChartLayoutInfo:

New properties called SelfDefinedLayouts, containing the self-defined layouts (this assures other own layout of further chart like : Cross, Campaign etc.). The properties should be initialized inside constructors of each chart whenever it needs to be used. In current scenario, it has just supported for Tracking with:

  • Chart is generated with one more Trend-line or not
  • Chart is generated with style of each series (brand) applied by their order or not
  • Others


AbstractCrossDiagramTester:

Common methods have been moved out to general AbstractDiagramTester, but not erased yet to assure its stability

2. Create new TrackingDiagramInfo:

TrackingDiagramInfo.png


TrackingDiagramInfo contains a DynamicExpressionResolver 2-D array (which each element is a brand item value


DynamicExpressionResolver :

Purpose to exist:

  • Not alike Cross diagram, Tracking diagram has expressions of branches exists independently from each other and might be set more complicated than short math-base axis set expressions of Cross diagram. Also for its filters (common filters of Filters node inside Tracking diagram editor).
  • Assure the flexibility of brand item value. Tracking diagram hasn't got concrete Axis object like Cross, just values of brand item as expressions. Expression might be realized as DynamicExpressionResolver in short format (filter format) like : Q1 == [1] or, in full format like : count() where Q1 == [1]
  • Handle validity of brand item value better (might be used in further Tracking/Campaign editor rebuilding)

Support:

  • Short format (Q1==1)
  • Not full format (count() where Q1==1)
  • Full format (=count() where Q1==1;)
  • Complex expression (={  var x=1; var y=1; ...; return (x+y);}) (Not full yet)

Limitation:

DynamicExpressionResolver hasn't support fully for CGScript (refer older engine's and FilterInfo's also). For example, user don't input as usual, but a cgscript function (like in Spreadsheet : = {  var sht... ; return sht; }, then our current filter-appending-in-last bussiness can dive into a rock when generated expression will be : = { var sht... ; return sht } && Q1==[1].

Solution might be use functions alike in Interpreter (where expression is parsed, get condition, math enumarator from AST etc.), or these existing Interpreter's functions would be set public.


3. Unit test

TrackingDiagramInfo UnitTest.png

  • Templates contains svgs of 2 simplest cases generated:
  1. From an one-levelled branch to one series
  2. From 2 one-levelled branches to 2 series
  • AbstractDiagramTester : Also ready to be used for AbstractCrossDiagramTester
  • AbstractTrackingDiagramTester has virtual initializing function contains data cache data for case "from an one-levelled branch to one series" which may be overriden in other & further cases

Document revisions

Version No. Date Changed By Description Svn revision
0.1 31.12.2009 Nguyen Trung Chinh Create the first version 59167
0.1.1 15.01.2009 Nguyễn Điển Nghĩa Initialize basic class