Compare the distribution of different applicati...
Created on Apr 10, 2025

Prompt

Compare the distribution of different application types (A vs N)

Chart

Query Results

Query Results

SQL Query:

SELECT
    appl_type AS category,
    COUNT(*) AS value,
    CASE appl_type
        WHEN 'A' THEN 'Application Type A'
        WHEN 'N' THEN 'Application Type N'
        ELSE 'Other'
    END AS series,
    CASE appl_type
        WHEN 'A' THEN 'Application Type A'
        WHEN 'N' THEN 'Application Type N'
        ELSE 'Other'
    END AS label,
    FALSE AS highlight
FROM
    orange_book_products
GROUP BY
    appl_type
UNION ALL
SELECT
    appl_type AS category,
    COUNT(*) AS value,
    CASE appl_type
        WHEN 'A' THEN 'Application Type A'
        WHEN 'N' THEN 'Application Type N'
        ELSE 'Other'
    END AS series,
    CASE appl_type
        WHEN 'A' THEN 'Application Type A'
        WHEN 'N' THEN 'Application Type N'
        ELSE 'Other'
    END AS label,
    FALSE AS highlight
FROM
    orange_book_patents
GROUP BY
    appl_type
UNION ALL
SELECT
    appl_type AS category,
    COUNT(*) AS value,
    CASE appl_type
        WHEN 'A' THEN 'Application Type A'
        WHEN 'N' THEN 'Application Type N'
        ELSE 'Other'
    END AS series,
    CASE appl_type
        WHEN 'A' THEN 'Application Type A'
        WHEN 'N' THEN 'Application Type N'
        ELSE 'Other'
    END AS label,
    FALSE AS highlight
FROM
    orange_book_exclusivities
GROUP BY
    appl_type;

Results:

categoryvalueserieslabelhighlight
A35795Application Type AApplication Type Afalse
N10562Application Type NApplication Type Nfalse
N19693Application Type NApplication Type Nfalse
A40Application Type AApplication Type Afalse
N2022Application Type NApplication Type Nfalse
Chart Configuration
{
  "color": [
    "#0088cc",
    "#cc0033"
  ],
  "title": {
    "top": "20px",
    "left": "center",
    "text": "Distribution of Application Types (A vs N)"
  },
  "xAxis": {
    "data": [
      "A",
      "N"
    ]
  },
  "yAxis": {
    "type": "value"
  },
  "legend": {
    "top": "center",
    "data": [
      "Application Type A",
      "Application Type N"
    ],
    "left": "left",
    "orient": "vertical"
  },
  "series": [
    {
      "data": [
        35795,
        0
      ],
      "name": "Application Type A",
      "type": "bar"
    },
    {
      "data": [
        0,
        10562
      ],
      "name": "Application Type N",
      "type": "bar"
    }
  ],
  "tooltip": {
    "trigger": "item",
    "formatter": "{a} <br/>{b} : {c} ({d}%)"
  }
}