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

Pie charts: empty filter buckets not displayed, legend inconsistent depending on data #4738

Closed
hegold opened this issue Aug 24, 2015 · 1 comment

Comments

@hegold
Copy link

hegold commented Aug 24, 2015

We have a pie chart visualization with slices split on filters. When the data is such that each filter bucket has some hits, the chart displays correctly. When there is no data matching a filter, however, that filter is not included in the slices and legend shown. This means that the colouring of the pie segments is inconsistent and varies based on the data.

Example legend from a pie with data in all buckets:
expected_legend

Example pie with data in only one bucket - note that the pie is green (usually associated with the 0-33.3 filter, however all data matches the 40-* filter and is expected to be purple to maintain consistency. This is so confusing to users that the pie is unusable on a dashboard.
piewrongcolourwronglegend

The visualization is set up as:
config

{
  "type": "pie",
  "params": {
    "addLegend": true,
    "addTooltip": true,
    "defaultYExtents": false,
    "isDonut": false,
    "shareYAxis": true,
    "spyPerPage": 10
  },
  "aggs": [
    {
      "id": "1",
      "type": "count",
      "schema": "metric",
      "params": {}
    },
    {
      "id": "3",
      "type": "terms",
      "schema": "split",
      "params": {
        "field": "fieldName",
        "size": 10,
        "order": "desc",
        "orderBy": "custom",
        "orderAgg": {
          "id": "3-orderAgg",
          "type": "avg",
          "schema": "orderAgg",
          "params": {
            "field": "fieldName",
            "json": ""
          }
        },
        "json": "{ \"order\" : {\"3-orderAgg\": \"asc\"}}",
        "row": false
      }
    },
    {
      "id": "2",
      "type": "filters",
      "schema": "segment",
      "params": {
        "filters": [
          {
            "input": {
              "query": {
                "query_string": {
                  "query": "value: {0 TO 33.3}",
                  "analyze_wildcard": true
                }
              }
            }
          },
          {
            "input": {
              "query": {
                "query_string": {
                  "query": "value: [33.3 TO 35]",
                  "analyze_wildcard": true
                }
              }
            }
          },
          {
            "input": {
              "query": {
                "query_string": {
                  "query": "value: {35 TO 40}",
                  "analyze_wildcard": true
                }
              }
            }
          },
          {
            "input": {
              "query": {
                "query_string": {
                  "query": "value: [40 TO *}",
                  "analyze_wildcard": true
                }
              }
            }
          }
        ]
      }
    }
  ],
  "listeners": {}
}

It seems that ElasticSearch returns the information needed to display all buckets so we believe this is a Kibana issue:

{
  "took": 703,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 318,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "3": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "2": {
            "buckets": {
              "value: {0 TO 33.3}": {
                "doc_count": 0
              },
              "value: [33.3 TO 35]": {
                "doc_count": 0
              },
              "value: {35 TO 40}": {
                "doc_count": 0
              },
              "value: [40 TO *}": {
                "doc_count": 156
              }
            }
          },
          "key": 582763,
          "doc_count": 156,
          "3-orderAgg": {
            "value": 582763
          }
        },
        {
          "2": {
            "buckets": {
              "value: {0 TO 33.3}": {
                "doc_count": 0
              },
              "value: [33.3 TO 35]": {
                "doc_count": 0
              },
              "value: {35 TO 40}": {
                "doc_count": 0
              },
              "value: [40 TO *}": {
                "doc_count": 162
              }
            }
          },
          "key": 583180,
          "doc_count": 162,
          "3-orderAgg": {
            "value": 583180
          }
        }
      ]
    }
  }
}

[Checked with Kibana 4.1.1]

@rashidkpc
Copy link
Contributor

Color issue is fixed in master: #4429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants