
    6Dh%3                         S SK r S SKJrJr  S SKJr  S SKJr  S SKrS SK	J
r  \R                  " S5      rS rSSSSSSSSSS0 4S	 jrg)
    N)
exceptionsoptional_imports)utilspandasc                 ~	   [        U 5      nUS:X  a  UOSnUS:X  a  SOUnU	(       d  SU-  n	U
(       d  SU-  n
[        R                  R                  UUSU	U
S9nUS   R	                  [        / S9SS	S
SS/ [        US:X  a  SOSS9S9  US   R	                  U5        US:X  a  SnSnOSnSnUS    HV  nSU;   d  SU;   a  SUS   U   S'   SUS   U   S'   UU;   a  SUS   U   S'   UU;   d  M>  SUS   U   S'   SS/US   U   S'   MX     US::  a  SS/US   US-      S'   U(       d  SS/nU(       d  SS/n[        U5       GHw  n[        [        U R                  U   S    5      5       H  n[        R                  " US   US   [        U R                  U   S    5      S!5      nUS:X  a"  [        U R                  U   S    5      S"U-
     /OS/nUS:X  a  S/O![        U R                  U   S    5      S"U-
     /n[        R                  " UU[        US"U-
     S#9S US:X  a  S$OS%US&SS'R                  US-   5      S(R                  US-   5      S)9
nUR                  U5        M     [        [        U R                  U   S*   5      5       H  n[        R                  " US   US   [        U R                  U   S*   5      S!5      nUS:X  a"  [        U R                  U   S*   5      S"U-
     /OS+/nUS:X  a  S+/O![        U R                  U   S*   5      S"U-
     /n[        R                  " UU[        US"U-
     S#9S*US:X  a  S$OS%USSS'R                  US-   5      S(R                  US-   5      S)9
nUR                  U5        M     US:X  a  U R                  U   S,   OS+/nUS:X  a  S+/OU R                  U   S,   n[        R                  " S7UUS,US:X  a  S$OS%S'R                  US-   5      S(R                  US-   5      S-.UD6nUR                  U5        U R                  U   S.   nS/U ;   a"  S0R                  U R                  U   S/   5      nOS1nS2R                  U5      U-   n[         R"                  " UUS:X  a  UU-
  OUS-   UUS:X  a  U
OU	US:X  a  S3OS4US:X  a  S5OSS5      nUS   S6==   U4-  ss'   GMz     U$ )8Nh   g      ?F)
print_gridhorizontal_spacingvertical_spacinglayout)shapeszBullet ChartiX  i  stackx   P   )l)titleheightwidth
showlegendbarmodeannotationsmarginyaxisxaxisshowgridzeroline	tickwidthshowticklabelsr   rangeg?g333333?1domainrgb(200, 200, 200)rgb(245, 245, 245)rgb(31, 119, 180)rgb(176, 196, 221)rangesrgb)colorxy   zx{}zy{})
r+   r,   markername	hoverinfoorientationr   baser   r   measuresg      ?markers)r+   r,   r/   r0   r   r   titles	subtitlesz<br>{} z	<b>{}</b>rowcolTr    )lenplotlysubplotsmake_subplotsupdatedictr    ilocclrsn_colorssortedgoBarformat	add_traceScatterr   annotation_dict_for_label)dfr4   r3   r'   r6   r5   r1   range_colorsmeasure_colorsr   r   scatter_optionslayout_optionsnum_of_lanesnum_of_rowsnum_of_colsfig
width_axislength_axiskeyr8   idxinter_colorsr+   r,   barr   subtitlelabelannots                                 O/var/www/html/env/lib/python3.13/site-packages/plotly/figure_factory/_bullet.py_bulletr^      s    r7L"-"4,!K"c)!|K </-
//
'
'-) ( C MB[C/cR8  	 M(c

8}c>W^-2CM#z*-2CM#z*#./CM#{+38CM#/0+,a&CM#w'  q58#JHj3&'1,.BC-/CD\"RWWS\(345C==Qa#bggcl86L2MuL
 #% X./S9:S  #% RWWS\(34R#X>? 
 &&,rCx"89!,!3#'ll37+ll37+C MM#5 6: RWWS\*567C==q!q!BGGCL,-	L #% Z01"s(;<U  #% RWWS\*56rCx@A 
 &&,rCx"89!,!3#'ll37+ll37+C MM#; 8@ (3c'9BGGCL#u C'SERWWS\)-D** 
(C/cS,,sQw',,sQw'
 
 	g X&"rwws|K'@AHH""5)H4//#.##5\C37 +s 28J C'EU3&DE
 	Hm$0${ #~ J    r   )r#   r$   )r%   r&   c                    [         (       d  [        S5      e[        R                  " U 5      (       a.  [	        S U  5       5      (       d  [
        R                  " S5      eO5[        U [         R                  5      (       d  [
        R                  " S5      e/ SQn[        R                  " U 5      (       a  [         R                  U(       a  U  Vs/ s H  oU   PM	     snOS/[        U 5      -  U(       a  U  Vs/ s H  oU   PM	     snOS/[        U 5      -  U(       a  U  Vs/ s H  oU   PM	     snO/ /[        U 5      -  U(       a  U  Vs/ s H  oU   PM	     snO/ /[        U 5      -  U(       a  U  Vs/ s H  oU   PM	     snO/ /[        U 5      -  /US9nO[        U [         R                  5      (       a  [         R                  U(       a  X   R                  5       OS/[        U 5      -  U(       a  X   R                  5       OS/[        U 5      -  U(       a  X   R                  5       O/ /[        U 5      -  U(       a  X   R                  5       O/ /[        U 5      -  U(       a  X   R                  5       O/ /[        U 5      -  /US9n[         R                  R                  W5      nS HF  n[        UU   5       H1  u  nn [        R                  " U5      nU(       d  Uc
  / UU   U'   M1  M3     MH     Xx4 Ha  nU(       d  M  [        U5      S	:w  a  [
        R                  " S
5      e[         R"                  " U5        [         R$                  " US5      S   nMc     SSSSS.0nU0 :X  a  UR'                  U5        O%US    H  nUUS   ;  d  M  US   U   US   U'   M     [)        UUUUUUUUUU	U
UU5      nU$ s  snf s  snf s  snf s  snf s  snf ! [         a     GM&  f = f)a  
**deprecated**, use instead the plotly.graph_objects trace
:class:`plotly.graph_objects.Indicator`.

:param (pd.DataFrame | list | tuple) data: either a list/tuple of
    dictionaries or a pandas DataFrame.
:param (str) markers: the column name or dictionary key for the markers in
    each subplot.
:param (str) measures: the column name or dictionary key for the measure
    bars in each subplot. This bar usually represents the quantitative
    measure of performance, usually a list of two values [a, b] and are
    the blue bars in the foreground of each subplot by default.
:param (str) ranges: the column name or dictionary key for the qualitative
    ranges of performance, usually a 3-item list [bad, okay, good]. They
    correspond to the grey bars in the background of each chart.
:param (str) subtitles: the column name or dictionary key for the subtitle
    of each subplot chart. The subplots are displayed right underneath
    each title.
:param (str) titles: the column name or dictionary key for the main label
    of each subplot chart.
:param (bool) orientation: if 'h', the bars are placed horizontally as
    rows. If 'v' the bars are placed vertically in the chart.
:param (list) range_colors: a tuple of two colors between which all
    the rectangles for the range are drawn. These rectangles are meant to
    be qualitative indicators against which the marker and measure bars
    are compared.
    Default=('rgb(200, 200, 200)', 'rgb(245, 245, 245)')
:param (list) measure_colors: a tuple of two colors which is used to color
    the thin quantitative bars in the bullet chart.
    Default=('rgb(31, 119, 180)', 'rgb(176, 196, 221)')
:param (float) horizontal_spacing: see the 'horizontal_spacing' param in
    plotly.tools.make_subplots. Ranges between 0 and 1.
:param (float) vertical_spacing: see the 'vertical_spacing' param in
    plotly.tools.make_subplots. Ranges between 0 and 1.
:param (dict) scatter_options: describes attributes for the scatter trace
    in each subplot such as name and marker size. Call
    help(plotly.graph_objs.Scatter) for more information on valid params.
:param layout_options: describes attributes for the layout of the figure
    such as title, height and width. Call help(plotly.graph_objs.Layout)
    for more information on valid params.

Example 1: Use a Dictionary

>>> import plotly.figure_factory as ff

>>> data = [
...   {"label": "revenue", "sublabel": "us$, in thousands",
...    "range": [150, 225, 300], "performance": [220,270], "point": [250]},
...   {"label": "Profit", "sublabel": "%", "range": [20, 25, 30],
...    "performance": [21, 23], "point": [26]},
...   {"label": "Order Size", "sublabel":"US$, average","range": [350, 500, 600],
...    "performance": [100,320],"point": [550]},
...   {"label": "New Customers", "sublabel": "count", "range": [1400, 2000, 2500],
...    "performance": [1000, 1650],"point": [2100]},
...   {"label": "Satisfaction", "sublabel": "out of 5","range": [3.5, 4.25, 5],
...    "performance": [3.2, 4.7], "point": [4.4]}
... ]

>>> fig = ff.create_bullet(
...     data, titles='label', subtitles='sublabel', markers='point',
...     measures='performance', ranges='range', orientation='h',
...     title='my simple bullet chart'
... )
>>> fig.show()

Example 2: Use a DataFrame with Custom Colors

>>> import plotly.figure_factory as ff
>>> import pandas as pd
>>> data = pd.read_json('https://cdn.rawgit.com/plotly/datasets/master/BulletData.json')

>>> fig = ff.create_bullet(
...     data, titles='title', markers='markers', measures='measures',
...     orientation='v', measure_colors=['rgb(14, 52, 75)', 'rgb(31, 141, 127)'],
...     scatter_options={'marker': {'symbol': 'circle'}}, width=700)
>>> fig.show()
z3'pandas' must be installed for this figure factory.c              3   B   #    U  H  n[        U[        5      v   M     g 7f)N)
isinstancer@   ).0items     r]   	<genexpr> create_bullet.<locals>.<genexpr>  s     ;dd:dD))ds   zGEvery entry of the data argument list, tuple, etc must be a dictionary.z=You must input a pandas DataFrame, or a list of dictionaries.)r5   rZ   r4   r3   r'   r7   )index)r'   r3   r4   r-   zKBoth 'range_colors' or 'measure_colors' must be a list of two valid colors.r(   r   r.      zdiamond-tallzrgb(0, 0, 0))sizesymbolr*   )pdImportErrorr   is_sequenceallr   PlotlyErrorrb   	DataFramer;   tolist	transpose	enumeratemathisnan	TypeErrorrB   validate_colorsconvert_colors_to_same_typer?   r^   )datar4   r3   r'   r6   r5   r1   rL   rM   r   r   rN   rO   	col_namesdrK   
needed_keyrW   rr_is_nancolors_listdefault_scatterkrS   s                           r]   create_bulletr      s   z 2OPP;d;;;((#  < bll++$$K
 	

 HI\\-3D)Dq6D)"D	9I09t,t!9t,tc$i?O.5T*T7T*B4#d);K/7d+d8d+bTCI=M-3D)Dq6D)"D	9I   	
 
D",,	'	'\\)/##%bTCI5E,5&&(B4#d);K*1$$&tc$i7G+3%%'"D	9I)/##%bTCI5E   	
 
			#B 8
:/FC::a=qy*,BzN3'  ) 0 8 %5;;1$ ,,+    -::;NqQK 6 	2.QO "/ !*A11/>x/H/K)!, + 
C  JO *,*+)0  s0   O8O
"OO6O
(O
O*)O*)rt   r<   r   r   plotly.colorscolorsrB   plotly.figure_factoryr   plotly.graph_objs
graph_objsrE   
get_modulerk   r^   r   r:   r_   r]   <module>r      sW     /  '    *fV =>xr_   