Discussions about CSEntry
Posts: 20
Joined: November 30th, 2017, 11:56 am


Postby Yihun_Shegnew » January 15th, 2018, 9:34 am

Dear programmers,

To customize the cspro-d3-chart which part of the application is update ?
In this folder there are many files associated with cspro data visualization.
Under the "report" folder there are html files and Java scripts codes so which one is editable to run based on the kind of data dictionary and report files?

Thanks in advance

Gregory Martin
Posts: 931
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Cspro-D3-chart

Postby Gregory Martin » January 15th, 2018, 10:03 am

You can study Josh's example here:


Here is the logic:

https://github.com/jhandley/cspro-D3-ch ... ts.ent.apc

Look, for example, at the countsVsExpectedReport function. He is writing out a JavaScript file with the input for the D3 chart.

    string reportDataFilename = maketext("%scounts-vs-expected-data.js", reportDataDirectory);
    setfile(tempFile, reportDataFilename);
    filewrite(tempFile, "var data = [");
    do i = 1 while i <= maxEa
        if householdsByEa(i) > 0 then
            EC_EA = i;
            if loadcase(EXPECTEDCOUNTS_DICT, EC_EA) then
                filewrite(tempFile, "  {EA: '%03d', households: %d, expected: %d},",
                          i, householdsByEa(i), EC_HOUSEHOLDS);
    filewrite(tempFile, "];");

Return to “Entry”