fbpx
Wikipedia

Módulo:ChartColors

Documentación del módulo[ver] [editar] [historial] [purgar]

A continuación se muestra la documentación transcluida desde la subpágina /doc. [salta a la caja de código]


Utilizado por {{ChartColors}} y {{ChartColorLegends}}

Para traducir o revisar la traducción a su idioma del módulo, edite con cuidado Data:I18n/ChartColors.tab.

Función ShowColors

Código Resultado
{{#invoke:ChartColors|ShowColors|Categ20|5}}                    
{{ChartColors|Categ20|9}}                                    
{{#invoke:ChartColors|ShowColors|Categ20|3|-}}     #1f77b4       #ff7f0e       #2ca02c  
{{#invoke:ChartColors|ShowColors|Categ20|3|a}}     #1f77b4ff       #ff7f0eff       #2ca02cff  
{{#invoke:ChartColors|ShowColors|Plotter|5}}                    
{{ChartColors|Plotter|20}}                                                                                

Función Legends

{{#invoke:ChartColors|Legends|paleta=Categ20|n_colores=5|n_cols=2}} 

produce:

  • 1f77b4
  • ff7f0e
  • 2ca02c
  • d62728
  • 9467bd

  • {{#invoke:ChartColors|Legends|paleta=Categ20|n_colores=3|n_cols=1|líneas= Un Dos Tres}} 

    produce:

  • Un
  • Dos
  • Tres

  • Esta documentación está transcluida desde Módulo:ChartColors/doc.
    Por favor, añade las categorías en la subpágina de documentación y los interwikis en Wikidata. Subpáginas de este módulo.
    local p = {}  local SA = require "Module:SimpleArgs" local CFCM = require "Module:ComplForColorModules" local TNTT = require "Module:TNTTools" local SD = require "Module:SimpleDebug"  local RS = {  ColorNameInvalid = 'ColorNameInvalid',  ColorNumInvalid = 'ColorNumInvalid',  StartNumInvalid = 'StartNumInvalid', } local i18n = {  [RS.ColorNameInvalid] = "El nom de la paleta de colors ($1) no és vàlid (ha de ser ''Categ20'' o ''Plotter'')",  [RS.ColorNumInvalid] = "El nombre de colors hauria d’estar entre 1 i $1 (ara és $2)",  [RS.StartNumInvalid] = "El número del primer color hauria d’estar entre 1 i $1 (ara és $2)", } local I18n = 'ChartColors' i18n = SA.loadI18n (I18n, i18n)  local function I18nStr (S, ...)  return SA.I18nStrParams (i18n[S], ...)  --return TNTT.GetMsgP (I18n, S, {...}) end  local category20 = {  '#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5',  '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5', } local plotter = {--from Module:Plotter/DefaultColors  'red', 'blue', 'green', 'yellow', 'fuchsia', 'aqua', 'brown', 'orange', 'purple', 'sienna',  '#F0A3FF', '#191919', '#005C31', 'honeydew', '#808080', 'khaki', 'lime', 'navy', 'pink', '#426600',  '#5EF1F2', 'turquoise', '#E0FF66', 'violet', '#FFFF80', '#FF5005', }  function p.GetColors (ColorName, IsInv, StartN, N, CallError)  local SelColors = {}  local ColorNameL = string.lower(ColorName)  local Palet0 = {}  if ColorNameL == 'categ20' then  Palet0 = category20  elseif ColorNameL == 'plotter' then  Palet0 = plotter  elseif CallError then  error (I18nStr (RS.ColorNameInvalid,ColorName),0)  end  MaxN = table.getn(Palet0)  if (N < 0) or (N > MaxN) then  error (I18nStr (RS.ColorNumInvalid,tostring(MaxN),tostring(N)),0)  else  Palet = {}  if IsInv then  for i=MaxN, 1, -1 do  table.insert(Palet, Palet0[i])  end  else  Palet = Palet0  end  if StartN > MaxN then  error (I18nStr (RS.StartNumInvalid,tostring(MaxN),tostring(StartN)),0)  end  local Step = 1  local NEnd = N  if (ColorNameL == 'categ20') and (N<=10) then  Step = 2  if StartN == 1 then  NEnd = N*2  end  end  if StartN == 1 then  for i=1, NEnd, Step do  table.insert(SelColors, Palet[i])  end  else  Count = 0  for i=StartN, MaxN, Step do  table.insert(SelColors, Palet[i])  Count = Count + 1  if Count == NEnd then  break  end  end  if Count < NEnd then  for i=1, MaxN, Step do  table.insert(SelColors, Palet[i])  Count = Count + 1  if Count == NEnd then  break  end  end  end  end  return SelColors  end end --GetColors  function p.ColorNameInvStartFromS (S)  local StartN = 1  local ParamsA = {}  function GetStartN (Pos)  SA.CheckSIsPosInt (ParamsA[Pos])  if SA.Error.yes then  p.MsgError()  else  StartN = tonumber (ParamsA[Pos])  end  end  local ColorName, IsInv  ColorName, IsInv, ParamsA = CFCM.ColorNameInvFromS0 (S)  local PN = table.getn(ParamsA)  if PN > 1 then  if ParamsA[2]=='i' then  IsInv = true  else  GetStartN (2)  end  if PN == 3 then  GetStartN (3)  end  end  return ColorName, IsInv, StartN end --ColorNameInvStartFromS  function ColorNameInv (args, WithName)  local S = CFCM.ColorNameInv0 (args, WithName)  local ColorName, IsInv, ParamsA = CFCM.ColorNameInvFromS0 (S)  local StartN = 1  ColorName, IsInv, StartN = p.ColorNameInvStartFromS (S)  return ColorName, IsInv, StartN end --ColorNameInv   function p.ShowColors(frame)  local args,Nargs = SA.GetArgs (frame)  if Nargs > 0 then  local ColorName, IsInv, StartN = ColorNameInv (args, false)  local N = SA.RPosInt_Par (args, 2)  local WriteColor = SA.Char_Par (args, 3, 'a-', '')  local ColorFound = {}  ColorFound = p.GetColors (ColorName, IsInv, StartN, N, true)  local boxes = {}  for i=1, table.getn(ColorFound) do  table.insert(boxes, CFCM.Box(ColorFound[i],WriteColor))  end  return table.concat(boxes, " ")  end end --ShowColors  function p.Legends(frame)  local args,Nargs = SA.GetArgs (frame)  if Nargs > 0 then  local ColorName, IsInv, StartN = ColorNameInv (args, true)  local n_colors = CFCM.N_Colors (args)  local ColorFound = {}  ColorFound = p.GetColors (ColorName, IsInv, StartN, n_colors, true)  return CFCM.LegendText (args, ColorFound, n_colors)  end end --Legends  return p 

    módulo, chartcolors, documentación, módulo, editar, historial, purgar, módulo, chartcolors, código, discusión, tests, comprobar, tests, subpáginas, enlaces, continuación, muestra, documentación, transcluida, desde, subpágina, salta, caja, código, utilizado, hr. Documentacion del modulo ver editar historial purgar Modulo ChartColors codigo doc discusion tests comprobar tests subpaginas enlaces A continuacion se muestra la documentacion transcluida desde la subpagina doc salta a la caja de codigo Utilizado por a href Plantilla ChartColors html title Plantilla ChartColors ChartColors a y ChartColorLegends Para traducir o revisar la traduccion a su idioma del modulo edite con cuidado Data I18n ChartColors tab Funcion ShowColors Codigo Resultado invoke ChartColors ShowColors Categ20 5 ChartColors Categ20 9 invoke ChartColors ShowColors Categ20 3 1f77b4 ff7f0e 2ca02c invoke ChartColors ShowColors Categ20 3 a 1f77b4ff ff7f0eff 2ca02cff invoke ChartColors ShowColors Plotter 5 ChartColors Plotter 20 Funcion Legends invoke ChartColors Legends paleta Categ20 n colores 5 n cols 2 produce 1f77b4ff7f0e2ca02c d627289467bd invoke ChartColors Legends paleta Categ20 n colores 3 n cols 1 lineas Un Dos Tres produce UnDosTresEsta documentacion esta transcluida desde Modulo ChartColors doc Por favor anade las categorias en la subpagina de documentacion y los interwikis en Wikidata Subpaginas de este modulo local p local SA require Module SimpleArgs local CFCM require Module ComplForColorModules local TNTT require Module TNTTools local SD require Module SimpleDebug local RS ColorNameInvalid ColorNameInvalid ColorNumInvalid ColorNumInvalid StartNumInvalid StartNumInvalid local i18n RS ColorNameInvalid El nom de la paleta de colors 1 no es valid ha de ser Categ20 o Plotter RS ColorNumInvalid El nombre de colors hauria d estar entre 1 i 1 ara es 2 RS StartNumInvalid El numero del primer color hauria d estar entre 1 i 1 ara es 2 local I18n ChartColors i18n SA loadI18n I18n i18n local function I18nStr S return SA I18nStrParams i18n S return TNTT GetMsgP I18n S end local category20 1f77b4 aec7e8 ff7f0e ffbb78 2ca02c 98df8a d62728 ff9896 9467bd c5b0d5 8c564b c49c94 e377c2 f7b6d2 7f7f7f c7c7c7 bcbd22 dbdb8d 17becf 9edae5 local plotter from Module Plotter DefaultColors red blue green yellow fuchsia aqua brown orange purple sienna F0A3FF 191919 005C31 honeydew 808080 khaki lime navy pink 426600 5EF1F2 turquoise E0FF66 violet FFFF80 FF5005 function p GetColors ColorName IsInv StartN N CallError local SelColors local ColorNameL string lower ColorName local Palet0 if ColorNameL categ20 then Palet0 category20 elseif ColorNameL plotter then Palet0 plotter elseif CallError then error I18nStr RS ColorNameInvalid ColorName 0 end MaxN table getn Palet0 if N lt 0 or N gt MaxN then error I18nStr RS ColorNumInvalid tostring MaxN tostring N 0 else Palet if IsInv then for i MaxN 1 1 do table insert Palet Palet0 i end else Palet Palet0 end if StartN gt MaxN then error I18nStr RS StartNumInvalid tostring MaxN tostring StartN 0 end local Step 1 local NEnd N if ColorNameL categ20 and N lt 10 then Step 2 if StartN 1 then NEnd N 2 end end if StartN 1 then for i 1 NEnd Step do table insert SelColors Palet i end else Count 0 for i StartN MaxN Step do table insert SelColors Palet i Count Count 1 if Count NEnd then break end end if Count lt NEnd then for i 1 MaxN Step do table insert SelColors Palet i Count Count 1 if Count NEnd then break end end end end return SelColors end end GetColors function p ColorNameInvStartFromS S local StartN 1 local ParamsA function GetStartN Pos SA CheckSIsPosInt ParamsA Pos if SA Error yes then p MsgError else StartN tonumber ParamsA Pos end end local ColorName IsInv ColorName IsInv ParamsA CFCM ColorNameInvFromS0 S local PN table getn ParamsA if PN gt 1 then if ParamsA 2 i then IsInv true else GetStartN 2 end if PN 3 then GetStartN 3 end end return ColorName IsInv StartN end ColorNameInvStartFromS function ColorNameInv args WithName local S CFCM ColorNameInv0 args WithName local ColorName IsInv ParamsA CFCM ColorNameInvFromS0 S local StartN 1 ColorName IsInv StartN p ColorNameInvStartFromS S return ColorName IsInv StartN end ColorNameInv function p ShowColors frame local args Nargs SA GetArgs frame if Nargs gt 0 then local ColorName IsInv StartN ColorNameInv args false local N SA RPosInt Par args 2 local WriteColor SA Char Par args 3 a local ColorFound ColorFound p GetColors ColorName IsInv StartN N true local boxes for i 1 table getn ColorFound do table insert boxes CFCM Box ColorFound i WriteColor end return table concat boxes end end ShowColors function p Legends frame local args Nargs SA GetArgs frame if Nargs gt 0 then local ColorName IsInv StartN ColorNameInv args true local n colors CFCM N Colors args local ColorFound ColorFound p GetColors ColorName IsInv StartN n colors true return CFCM LegendText args ColorFound n colors end end Legends return pObtenido de https es wikipedia org w index php title Modulo ChartColors amp oldid 122191955, wikipedia, wiki, leyendo, leer, libro, biblioteca,

    español

    , española, descargar, gratis, descargar gratis, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, imagen, música, canción, película, libro, juego, juegos