XEROF

 

xlsgen 3.0 build #39 : Geomaps (II)


Build 3.0.0.39 of xlsgen continues on the previous build on geomaps, this time adding color gradients and a few visual component interface helpers.

Color gradients is a convenient mechanism for creating color ranges instead of declaring every single color a country/state/region should be displayed with. The obvious scenario for this is business intelligence where using colors such as red and green can be used to highlight zones of stress.

The other improvement is on visual component parametering. Before that build, when you had to pass a literal such as a number or a string, you would pass something such as Formula = "=50" or Formula = "\"string\"". Not exactly user-friendly even though from a strict capability point of view, passing formulas carries all the strength of arbitrary Excel formulas, used to populate maps!
Well, the new helpers let you pass numbers or strings very easily. In the example above, that would be ValueAsNumber = 50, and ValueAsLabel = "string", respectively.

Here is a sample code for illustrating the point of color gradients.




 ^;
sample 4 : Euro zone GDP per country, with and without associated values


In this sample, the data is actual Euro stats data available here :




sample 4 data : Euro stats




The data is sorted by GDP, and it is convenient to associate a color gradient to the GDP so that countries with higher GDP will be greener and countries with lower GDP will be more red.



And here is the full source code, data and geomaps creation in C++ :




xlsgen::IXlsWorkbookPtr wbk = engine->New( L"geomaps.xls" );

xlsgen::IXlsWorksheetPtr wksht001 = wbk->AddWorksheet(L"sheet");

xlsgen::IXlsVisualComponentPtr comp = wksht001->NewVisualComponent(L"Geomaps.ARsTdesign.1",
1, // row1
3, // col1
29, // row2
10, // col2
0,0,0,0);

// data source : http://epp.eurostat.ec.europa.eu/cache/ITY_PUBLIC/2-20062012-AP/EN/2-20062012-AP-EN.PDF

wksht001->Cell[1][1]->HtmlLabel = L"<span width=15.425781><font size=12><b>Country</b></font></span>";
wksht001->Cell[1][2]->HtmlLabel = L"<span width=12.570313><font size=12><b>GDP</b></font></span>";
wksht001->Cell[2][1]->HtmlLabel = L"<span>Luxembourg</span>";
wksht001->Cell[2][2]->HtmlFloat = L"<span>274</span>";
wksht001->Cell[3][1]->HtmlLabel = L"<span>Netherlands</span>";
wksht001->Cell[3][2]->HtmlFloat = L"<span>131</span>";
wksht001->Cell[4][1]->HtmlLabel = L"<span>Austria</span>";
wksht001->Cell[4][2]->HtmlFloat = L"<span>129</span>";
wksht001->Cell[5][1]->HtmlLabel = L"<span>Ireland</span>";
wksht001->Cell[5][2]->HtmlFloat = L"<span>127</span>";
wksht001->Cell[6][1]->HtmlLabel = L"<span>Sweden</span>";
wksht001->Cell[6][2]->HtmlFloat = L"<span>126</span>";
wksht001->Cell[7][1]->HtmlLabel = L"<span>Denmark</span>";
wksht001->Cell[7][2]->HtmlFloat = L"<span>125</span>";
wksht001->Cell[8][1]->HtmlLabel = L"<span>Germany</span>";
wksht001->Cell[8][2]->HtmlFloat = L"<span>120</span>";
wksht001->Cell[9][1]->HtmlLabel = L"<span>Belgium</span>";
wksht001->Cell[9][2]->HtmlFloat = L"<span>118</span>";
wksht001->Cell[10][1]->HtmlLabel = L"<span>Finland</span>";
wksht001->Cell[10][2]->HtmlFloat = L"<span>116</span>";
wksht001->Cell[11][1]->HtmlLabel = L"<span>United kingdom</span>";
wksht001->Cell[11][2]->HtmlFloat = L"<span>108</span>";
wksht001->Cell[12][1]->HtmlLabel = L"<span>France</span>";
wksht001->Cell[12][2]->HtmlFloat = L"<span>107</span>";
wksht001->Cell[13][1]->HtmlLabel = L"<span>Italy</span>";
wksht001->Cell[13][2]->HtmlFloat = L"<span>101</span>";
wksht001->Cell[14][1]->HtmlLabel = L"<span>Spain</span>";
wksht001->Cell[14][2]->HtmlFloat = L"<span>99</span>";
wksht001->Cell[15][1]->HtmlLabel = L"<span>Cyprus</span>";
wksht001->Cell[15][2]->HtmlFloat = L"<span>92</span>";
wksht001->Cell[16][1]->HtmlLabel = L"<span>Slovenia</span>";
wksht001->Cell[16][2]->HtmlFloat = L"<span>84</span>";
wksht001->Cell[17][1]->HtmlLabel = L"<span>Malta</span>";
wksht001->Cell[17][2]->HtmlFloat = L"<span>83</span>";
wksht001->Cell[18][1]->HtmlLabel = L"<span>Greece</span>";
wksht001->Cell[18][2]->HtmlFloat = L"<span>82</span>";
wksht001->Cell[19][1]->HtmlLabel = L"<span>Czech republic</span>";
wksht001->Cell[19][2]->HtmlFloat = L"<span>80</span>";
wksht001->Cell[20][1]->HtmlLabel = L"<span>Portugal</span>";
wksht001->Cell[20][2]->HtmlFloat = L"<span>77</span>";
wksht001->Cell[21][1]->HtmlLabel = L"<span>Slovakia</span>";
wksht001->Cell[21][2]->HtmlFloat = L"<span>73</span>";
wksht001->Cell[22][1]->HtmlLabel = L"<span>Estonia</span>";
wksht001->Cell[22][2]->HtmlFloat = L"<span>67</span>";
wksht001->Cell[23][1]->HtmlLabel = L"<span>Hungary</span>";
wksht001->Cell[23][2]->HtmlFloat = L"<span>66</span>";
wksht001->Cell[24][1]->HtmlLabel = L"<span>Poland</span>";
wksht001->Cell[24][2]->HtmlFloat = L"<span>65</span>";
wksht001->Cell[25][1]->HtmlLabel = L"<span>Lithuania</span>";
wksht001->Cell[25][2]->HtmlFloat = L"<span>62</span>";
wksht001->Cell[26][1]->HtmlLabel = L"<span>Latvia</span>";
wksht001->Cell[26][2]->HtmlFloat = L"<span>58</span>";
wksht001->Cell[27][1]->HtmlLabel = L"<span>Romania</span>";
wksht001->Cell[27][2]->HtmlFloat = L"<span>49</span>";
wksht001->Cell[28][1]->HtmlLabel = L"<span>Bulgaria</span>";
wksht001->Cell[28][2]->HtmlFloat = L"<span>45</span>";

comp->ParameterByName[L"SetTitle"]->ValueAsLabel = L"Euro zone GDP per country in 2011";

// countries
comp->ParameterByName[L"SetRegions"]->Formula = L"=A2:A28"; // area reference

// GDP
comp->ParameterByName[L"SetLabels"]->Formula = L"=B2:B28"; // area reference

// color gradient
comp->ParameterByName[L"SetAdditionalColor"]->ValueAsNumber = 0x00FF00; // green
comp->ParameterByName[L"SetAdditionalColor"]->ValueAsNumber = 0xFF0000; // red

// background color
comp->ParameterByName[L"SetBackgroundColor"]->ValueAsNumber = 0xCCCCCC;

wksht001->PageSetup->PageOrientation = FALSE;
wksht001->Export->ExportAsPDF(L"geomaps.pdf");

wbk->Close();

Posted on 23-June-2012 13:48 | Category: xlsgen, Excel generator | comment[0] | trackback[0]

 

 

<-- previous page

< June >
0102030405
0607080910
1112131415
1617181920
2122232425
2627282930



 

 

This site
Home
Articles

DevTools
CPU-Z
EditPlus
ExplorerXP
Kill.exe
OllyDbg
DependencyWalker
Process Explorer
autoruns.exe
Araxis
COM Trace injection
CodeStats
NetBrute
FileMon/Regmon
BoundsChecker
AQTime profiler
Source monitor
GDI leaks tracking
Rootkit revealer
Rootkit removal
RunAsLimitedUser(1)
RunAsLimitedUser(2)

 

 

Liens
Le Plan B
Un jour à Paris
Meneame
Rezo.net (aggr)
Reseau voltaire
Cuba solidarity project
Le grand soir
L'autre journal
Le courrier suisse
L'Orient, le jour
Agoravox (aggr)