<commit_before>﻿# Setting up a dev environment
1. Clone the repository; `git clone https://github.com/Cal7/power-bi-radar`
2. `cd` into the directory
3. Install its Node packages; `npm install`
4. Start the visual's server; `pbiviz start`. If an "Invalid API version" occurs, run `pbiviz update`

Note: if this is the first custom visual to be running on the machine then there are a few extra steps to be performed first; namely, `npm install -g powerbi-visuals-tools` will install the tool used to start and stop the visual's server (amongst other things). This server only allows communication over HTTPS, so the steps [here](https://github.com/Microsoft/PowerBI-visuals/blob/master/tools/CertificateAddWindows.md) must also be followed (this does not need to be repeated for other visuals).

Custom visuals in development can only be viewed via [Power BI's online service](https://app.powerbi.com). "Enable developer visual for testing" must first be checked within Settings>General. Once this is done an extra icon will appear in the Visualizations window.

# Using the visual in Power BI Desktop
When a visual is ready, it may be packaged for use in Power BI Desktop. Run `pbiviz package`, which produces a `radar.pbiviz` file within the `dist` directory. From here, one can import the visual into PBI Desktop by clicking on the three dots in the Visualizations pane, and choosing "Import from file". It can now be used in the report like any standard visual.

# External libraries
The visual uses three external JavaScript libraries; [d3](https://d3js.org/) to ease DOM manipulation, [lodash](https://lodash.com/) to provide common utilities like removing duplicates from an array, and [TinyColor](https://github.com/bgrins/TinyColor) for common colour manipulations (such as converting hex codes to HSL, darkening a colour, etc.)

External libraries get defined in tsconfig.json by adding their file locations to the "files" array. It is recommended to also add the relevant typings files.<commit_msg>Added hierarchy paragraph to readme<commit_after>﻿# Setting up a dev environment
1. Clone the repository; `git clone https://github.com/Cal7/power-bi-radar`
2. `cd` into the directory
3. Install its Node packages; `npm install`
4. Start the visual's server; `pbiviz start`. If an "Invalid API version" occurs, run `pbiviz update`

Note: if this is the first custom visual to be running on the machine then there are a few extra steps to be performed first; namely, `npm install -g powerbi-visuals-tools` will install the tool used to start and stop the visual's server (amongst other things). This server only allows communication over HTTPS, so the steps [here](https://github.com/Microsoft/PowerBI-visuals/blob/master/tools/CertificateAddWindows.md) must also be followed (this does not need to be repeated for other visuals).

Custom visuals in development can only be viewed via [Power BI's online service](https://app.powerbi.com). "Enable developer visual for testing" must first be checked within Settings>General. Once this is done an extra icon will appear in the Visualizations window.

# Using the visual in Power BI Desktop
When a visual is ready, it may be packaged for use in Power BI Desktop. Run `pbiviz package`, which produces a `radar.pbiviz` file within the `dist` directory. From here, one can import the visual into PBI Desktop by clicking on the three dots in the Visualizations pane, and choosing "Import from file". It can now be used in the report like any standard visual.

# External libraries
The visual uses three external JavaScript libraries; [d3](https://d3js.org/) to ease DOM manipulation, [lodash](https://lodash.com/) to provide common utilities like removing duplicates from an array, and [TinyColor](https://github.com/bgrins/TinyColor) for common colour manipulations (such as converting hex codes to HSL, darkening a colour, etc.)

External libraries get defined in tsconfig.json by adding their file locations to the "files" array. It is recommended to also add the relevant typings files.

# The radar "hierarchy"
There are four main classes involved in representing a radar as a whole. The overall class is a Radar. This has a property called sectors, which is an array of Sector instances. In each Sector instance is an array of Blip instances. Each Blip then has a Ring.
{'fraction_non_alphanumeric': 0.06820809248554913, 'fraction_numerical': 0.0032369942196531793, 'mean_word_length': 4.684625492772668, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5651201', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1074, 'n_words': 626}