Add charts configuration options

Issue #140 resolved
Ed McDonagh created an issue

Add page to Admin menu for configuration.

Start with charts on or off, then if on, no weight (bar charts/histograms) or with weight (scatter plots, for future) or both.

Will need new database table, template, form.

Comments (14)

  1. David Platten

    @edmcdonagh, I think the charts on / off functionality could be implemented using the sessions functionality of Django ( We could use checkboxes on the html pages that toggle session objects, such as a "display_charts" session object that changes from from visible to hidden. The session information can be accessed from and the html pages. So, for example, the chart data is only calculated and displayed if the "display_charts" session object is set to "visible".

    This could be used for all the options that we are thinking of putting in.

  2. David Platten

    Perhaps Django's forms is what is needed to control the options for chart plotting etc. See

    We could have a form that has on / off options for each of the charts in the various views. Hopefully the code can then access the values that are set in the form.

    This could also be used for other options that need to be set.

  3. David Platten

    I've added a very simple form to a local test version. This is a manually-written form at the moment. When this is submitted, can access the value stored in the request information. For this to be "sticky" I need somewhere to store the settings that the user has set: should this be a new database field somewhere that is specific to the user?I could encode it in the url, I think. chartOptions.jpg

  4. David Platten

    OK. So what I think I want to do is to extend the existing user model so that I can include additional settings for each user, such as whether they want certain charts to display. The user will be able to change these settings via some sort of form. The form values can be set to the current data; if the user changes any of them and submits the form then they will be changed in the database. The code will be modified to only carry out queries to obtain charting data if the appropriate settings are true. See

    @edmcdonagh, do you have a view on this?

  5. Ed McDonagh reporter

    Sounds good. We'll need to get over the horrible hump of changing the table names before making any further changes to the models...

    I'm trying to get there! The migration files need to be written by hand as South can't autodetect changes to model names :(

  6. David Platten

    Following some recent work it is now possible to configure whether plots are calculated and displayed for individual users. As well as a global "Charts on or off" it is also possible to configure which individual plots are shown. The plot settings for a user can be changed in the admin page.

    What I think really needs to happen is for the on / off plot options to be visible to the user on the CT and radiographic filtered pages as part of a form. The plots can be switched off by default, but if a user then wants to see a plot of the filtered data that they are currently displaying then they will be able to click a "switch on mean DLP plot" checkbox, press submit and the plot will appear.

    I haven't yet worked out how to generate a form on dxfiltered.html that will enable the user to see their plotting choices, and also enable them to interactively change them by submitting the form.

  7. David Platten

    I've worked out how to generate the forms that I need. The user is now able to switch charts completely on or off on the radiographic and CT pages. They are also able to switch individual charts on or off. See commits 8b9b604 (radiographic) and 221a592 (CT). I think this issue might be sorted, but it will need someone to check...

  8. Log in to comment