> For the complete documentation index, see [llms.txt](https://docs.shimoku.com/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shimoku.com/dev/releases/2022/v.0.12.md).

# v.0.12

On 2022.12.13

{% hint style="danger" %}
This version has been deprecated. If used with the current API version it can produce unexpected behaviour or errors.
{% endhint %}

{% hint style="danger" %}
The package shimoku-api-python is no longer maintained
{% endhint %}

{% hint style="info" %}
To get the new version :tada:
{% endhint %}

```
pip install --upgrade shimoku-api-python
```

This version is a small update that includes three new plots and upgrades to the indicator report.

### Improvements <a href="#fixes" id="fixes"></a>

* Now a background image can be provided to the indicators, and variants can be specified also! The possible variants are:

  &#x20;              `'default' 'outlined' 'contained' 'topColor'`               &#x20;

  So now this indicators are possible:

  <figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2F25TaQsCiHON1kDvN7Q2P%2FScreenshot%20from%202022-12-13%2016-33-10.png?alt=media&amp;token=4b2f2736-7d7d-4cd9-b205-8ce7765ccf7d" alt=""><figcaption></figcaption></figure>

  The new features have been added as parameters of the function `s.plt.indicator`. To get the result shown above the following code has been executed:

  ```python
  data_ = [{
      "color": "success",
      "variant": "contained",
      "description": "This indicator has a Link",
      "targetPath": "/indicators/indicator/1",
      "title": "Target Indicator",
      "align": "left",
      "value": "500€"
  }, {
      "color": "warning",
      "backgroundImage": "https://images.unsplash.com/photo-1535957998253-26ae1ef29506?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=736&q=80",
      "variant": "outlined",
      "description": "This has a background",
      "title": "Super cool indicator",
      "align": "left",
      "value": "Value"
  }, {
      "color": "error",
      "variant": "outlined",
      "description": "This hasn't got any icons",
      "title": "Error indicator",
      "align": "left",
      "value": "Value",
  }, {
      "color": "caution",
      "variant": "contained",
      "description": "Aligned to right and full of icons",
      "title": "Multiple cases",
      "align": "right",
      "value": "Value",
  }
  ]
  s.plt.indicator(
      data=data_,
      menu_path=menu_path,
      order=2, rows_size=2, cols_size=12,
      value='value',
      header='title',
      footer='description',
      align='align',
      color='color',
      variant='variant',
      target_path='targetPath',
      background_image='backgroundImage',
  )
  ```

* A stacked bar chart has been added! So now you can visualize the sum of various categories in an intuitive way. Using the following .csv dataset:

  ```csv
  Segment, Price, Client category, Age, Geo, Acquisitive power, Family size, Policie tenure, Labour contract
  Hogar, 21, 5, 12, 17, 3, 14, 3, 6
  Móvil, 23, 16, 16, 14, 4, 2, 19, 12
  Dental, 26, 21, 14, 17, 1, 2, 6, 3
  Viajes, 24, 22, 15, 17, 8, 5, 15, 4
  Accidentes, 22, 12, 18, 17, 5, 6, 1, 5
  Seguro de vida, 22, 21, 19, 12, 7, 3, 2, 9
  Jurídico, 25, 21, 13, 12, 10, 6, 13, 6
  Dental Plus, 24, 4, 17, 17, 7, 9, 2, 3
  Jubilación, 20, 4, 19, 17, 2, 2, 10, 8
  Salud, 27, 24, 17, 17, 12, 1, 4, 1
  ```

  and executing the following code:

  ```python
  data = pd.read_csv('file.csv')

  s.plt.stacked_barchart(
      data=data,
      menu_path=menu_path,
      x="Segment",
      x_axis_name='Distribution and weight of the Drivers',
      order=0,
      rows_size=3, cols_size=12,
  )
  ```

  the result is:

  <figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FgrQNFnamdHPPkA979hHy%2Fimatge.png?alt=media&amp;token=6d0e6522-fdf0-4fa6-b70e-d06c085d1418" alt=""><figcaption><p>Default result</p></figcaption></figure>

  The function has the option to hide or show each level by using the parameter `show_values` where the columns of the dataset that will show it's values have to be specified, by default it will show all the values. Also this type of plot is very useful to visualize percentages of the fields for each category, to do it, the parameter `calculate_percentages` has to be set to `True`, when activated it will calculate for each value of each category the percentage from the total.

  When executing the following code:

  <pre class="language-python"><code class="lang-python">data = pd.read_csv('file.csv')

  s.plt.stacked_barchart(
      data=data_,
      menu_path=menu_path,
      x="Segment",
      x_axis_name='Distribution and weight of the Drivers',
      order=0,
      rows_size=3, cols_size=12,
  <strong>    show_values=['Price'],
  </strong><strong>    calculate_percentages=True,
  </strong>)
  </code></pre>

  the resulting plot is:

  <figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FeufYbSxdOdYdJqsLU0mh%2Fimatge.png?alt=media&amp;token=6312b837-5a4a-482a-87ae-f0d0f653caf0" alt=""><figcaption><p>Result calculating percentages per category and showing only the first level of values.</p></figcaption></figure>

* We also added a new type of gauge charts with the Shimoku flavour, they are called the Shimoku gauges. They are minimalist and useful for a quick view on various metrics. The function to use them is `s.plt.shimoku_gauge`.

  The method accepts various types of colors as the parameter color. There are a group of default colors that can be used passing an integer from 1 to 10, also it can accept some keywords that will activate dashboard specific colors, the list is:

  ```
  'success', 'error', 'warning', 'success-light', 'error-light', 'warning-light', 'status-error'
  ```

  By default they show the percentage symbol but it can be deactivated by setting the parameter `is_percentage` to `False`.

  An example on how to use them is:

  ```python
  s.plt.shimoku_gauge(
      value=-48, menu_path=menu_path, order=0,
      rows_size=1, cols_size=3, name="Shimoku",
      color=1)
      
  s.plt.shimoku_gauge(
      value=3.56, menu_path=menu_path, order=1,
      rows_size=1, cols_size=3,
      color="status-error")
      
  s.plt.shimoku_gauge(
      value=-90, menu_path=menu_path, order=2,
      rows_size=1, cols_size=3, name="gauges",
      color='#00F0FF')
  ```

  Which results in:

  <figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FgpW8DnwgHXv5Kdd7OFDa%2Fimatge.png?alt=media&amp;token=4e690fb5-2829-4609-b9c6-f1af0d7dc06c" alt=""><figcaption><p>Shimoku gauges</p></figcaption></figure>

* The last plot added is the Shimoku gauges group, it makes use of the Shimoku gauge and the Bento box feature. It takes as data a list of dictionaries (or dataframe) where the necessary information for each gauge must be provided.&#x20;

  This component can calculate the percentages of the group of gauges provided, like the stacked bar chart component, this can be activated by setting the parameter `calculate_percentages` to `True`.

  In the next example the previously mentioned .csv will be used to make a group of gauges:

  ```python
  menu_path: str = 'test/shimoku-gauges'
  df = pd.read_csv('file.csv')
  gauges_data = pd.DataFrame(columns=["name", "value", "color"])
  df_transposed = df.transpose().reset_index().drop(0)
  value_columns = [col for col in df_transposed.columns if col != "index"]
  gauges_data["value"] = df_transposed[value_columns].apply(lambda row: sum(row), axis=1)
  gauges_data["name"] = df_transposed['index']
  gauges_data["color"] = range(1, len(df_transposed) + 1)

  order = s.plt.shimoku_gauges_group(
      gauges_data=gauges_data,
      order=0, menu_path=menu_path,
      cols_size=12, rows_size=3,
      calculate_percentages=True,
  )
  ```

  That results in:

  <figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FSnIk64Y7xD1aher5YcDB%2Fimatge.png?alt=media&amp;token=eb0b5502-e2bc-4726-9b57-15bff75e9568" alt=""><figcaption><p>Shimoku gauges group with percentages calculated</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.shimoku.com/dev/releases/2022/v.0.12.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
