Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catalog-level CSV tableStyle #1111

Open
stevage opened this issue Nov 30, 2015 · 0 comments
Open

Catalog-level CSV tableStyle #1111

stevage opened this issue Nov 30, 2015 · 0 comments

Comments

@stevage
Copy link
Contributor

stevage commented Nov 30, 2015

It would solve a few problems if in an init file could define column names that would be styled in a certain way for any CSV file dropped in, across a whole catalog. That is, something like:

{
    "catalog": [ 
       "..."
    ],
    "columnStyles": [{
        "columnRegex": ".*_change$",
        "tableStyle": {
            "colorMap": [ 
                {
                    "value": "-10",
                    "color": "red",
                }, {
                    "value": "0",
                    "color": "white",
                }, {
                    "value": "10",
                    "color": "blue"
                }
            ]
        }
    }, {
        "columnRegex": "^Party$",
        "tableStyle": {
            "colorMap": [ 
                {
                    "value": "ALP",
                    "color": "hsl(20,80%,60%)",
                }, {
                    "value": "LNP",
                    "color": "hsl(250, 80%, 60%)",
                }, {
                    "value": null,
                    "color": "grey" // applied to "other" values
                }
            ]
        }
    }
    ]
}

Benefits:

  • Catalog managers can define colour schemes that will work for any conformant CSV files dropped in.
  • Less repetitive than defining colour schemes for every CSV file in a catalog
  • More flexible (and greater scope for domain-specificity) than us defining rules like this that apply in every TerriaJS instance
  • Opens up the intriguing possibility of catalog files that just contain styles, so "nationalmap.gov.au#electoral" could be just styles for CSVs that you're about to drop in.
  • Probably solves the actual problem behind the request for per-row colours, and keeps presentation metadata out of the CSV.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant