Simple example using just the Bar class

    This example is intended to show usage of the Bar class at the lowest
    level.
484270
def simple():
    
    MAX_VALUE = 100

    # Create our test progress bar
    bar = Bar(max_value=MAX_VALUE, fallback=True)

    bar.cursor.clear_lines(2)
     # Before beginning to draw our bars, we save the position
    #   of our cursor so we can restore back to this position before writing
    #   the next time.
    bar.cursor.save()
    for i in range(MAX_VALUE + 1):
        sleep(0.1 * random.random())
        # We restore the cursor to saved position before writing
        bar.cursor.restore()
        # Now we draw the bar
        bar.draw(value=i)
857159
function _class(_ref) {
    var args = _ref.args;
    var config = _ref.config;

    _classCallCheck(this, _class);

    var on = null;
    var from = '*';
    var cbOn = null;
    var cbOff = null;
    var alwaysTrigger = false;

    var _iteratorNormalCompletion = true;
    var _didIteratorError = false;
    var _iteratorError = undefined;

    try {
      for (var _iterator = args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var arg = _step.value;

        switch (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) {
          case 'string':
            if (on === null) {
              on = arg;
            } else {
              from = arg;
            }
            break;
          case 'function':
            if (cbOn === null) {
              cbOn = arg;
            } else {
              cbOff = arg;
            }
            break;
          case 'boolean':
            alwaysTrigger = arg;
        }
      }
    } catch (err) {
      _didIteratorError = true;
      _iteratorError = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion && _iterator.return) {
          _iterator.return();
        }
      } finally {
        if (_didIteratorError) {
          throw _iteratorError;
        }
      }
    }

    _extends(this, {
      isActive: null,
      matchesOn: parseMatchInputString(on, config.inversePrefix),
      matchesFrom: parseMatchInputString(from, config.inversePrefix),
      cbOn: cbOn, cbOff: cbOff, alwaysTrigger: alwaysTrigger
    });
  }
275168
def bar(h1: Histogram1D, ax: Axes, *, errors: bool = False, **kwargs):
    """"""
    show_stats = kwargs.pop("show_stats", False)
    show_values = kwargs.pop("show_values", False)
    value_format = kwargs.pop("value_format", None)
    density = kwargs.pop("density", False)
    cumulative = kwargs.pop("cumulative", False)
    label = kwargs.pop("label", h1.name)
    lw = kwargs.pop("linewidth", kwargs.pop("lw", 0.5))
    text_kwargs = pop_kwargs_with_prefix("text_", kwargs)

    data = get_data(h1, cumulative=cumulative, density=density)

    if "cmap" in kwargs:
        cmap = _get_cmap(kwargs)
        _, cmap_data = _get_cmap_data(data, kwargs)
        colors = cmap(cmap_data)
    else:
        colors = kwargs.pop("color", None)

    _apply_xy_lims(ax, h1, data, kwargs)
    _add_ticks(ax, h1, kwargs)

    if errors:
        err_data = get_err_data(h1, cumulative=cumulative, density=density)
        kwargs["yerr"] = err_data
        if "ecolor" not in kwargs:
            kwargs["ecolor"] = "black"

    _add_labels(ax, h1, kwargs)
    ax.bar(h1.bin_left_edges, data, h1.bin_widths, align="edge",
           label=label, color=colors, linewidth=lw, **kwargs)

    if show_values:
        _add_values(ax, h1, data, value_format=value_format, **text_kwargs)
    if show_stats:
        _add_stats_box(h1, ax, stats=show_stats)
189512
public boolean barIsEmpty(Bar bar) {
        for (Object o : getBarContent(bar)) {
            MusicElement me = (MusicElement) o;
            if (!(me instanceof BarLine) && !(me instanceof Spacer))
                return false;
        }
		return true;
	}
452479
Rule Barline() {
		return FirstOf(
			InvisibleBarline(),
			TripleBarline(),
			Sequence("::", ZeroOrMore(':'), '|').suppressNode(),
			String("::").suppressNode(),
			Sequence(
				ZeroOrMore(':'),
				ZeroOrMore('['),
				OneOrMore('|'),
				ZeroOrMore(']'),
				ZeroOrMore(':')
			).suppressNode(),
			DashedBarline()
		).label(Barline);
	}
1339095
@Override
	public InstanceExample nextInstance() {
		InstanceExample prevInstance = this.lastInstanceRead;
		if (prevInstance != null) {
			this.numInstancesRead++;
		}
		try {
			String line;
			do {
				line = this.fileReader.readLine();
				if (line == null) {
					break;
				}
				line = line.trim();
			} while (line.isEmpty() || line.charAt(0) == '%'
					|| line.charAt(0) == '@');

			if (line != null) {
				StringTokenizer token = new StringTokenizer(line,
						splitCharOption.getValue());

				double[] value = new double[this.numAttributes];
				int i;
				for (i = 0; i < this.numTokens && token.hasMoreTokens(); i++) {
					value[i] = Double.valueOf(token.nextToken());
				}
				if (i < this.numTokens || token.hasMoreTokens()) {
					throw new RuntimeException(
							"Next Instance has an wrong cardinality!");
				}
				this.lastInstanceRead = new InstanceExample(new DenseInstance(1, value));
				this.lastInstanceRead.getData().setDataset(this.dataset);
				this.hitEndOfFile = false;
			} else {
				this.lastInstanceRead = null;
				this.hitEndOfFile = true;
			}
		} catch (IOException ioe) {
			throw new RuntimeException("Read next Instance failed.", ioe);
		}
		return prevInstance;
	}
1312753
def on_bar_data(self, bars):
        """"""
        for tick in XmlHelper.node_iter(bars):
            names = [str(tick.getElement(_).name()) for _ in range(tick.numElements())]
            barmap = {n: XmlHelper.get_child_value(tick, n) for n in names}
            self.response.bars.append(barmap)
785603
function DrawBars() {

    if ($this->data_type != "text-data") {
      $this->DrawError('Bar plots must be text-data: use function SetDataType("text-data")');
    }

    $xadjust = ($this->records_per_group * $this->record_bar_width )/4;

    reset($this->data_values);
    while (list($j, $row) = each($this->data_values)) {

      $color_index = 0;
      $colbarcount = 0;
      $x_now = $this->xtr($j+.5);

      while (list($k, $v) = each($row)) {
        if ($k == 0) {
          //Draw Data Labels
          $xlab = SubStr($v,0,$this->x_datalabel_maxlength);
          $this->DrawXDataLabel($xlab,$x_now);
        } else {
          // Draw Bars ($v)
          $x1 = $x_now - $this->data_group_space + ($k-1)*$this->record_bar_width;
          $x2 = $x1 + $this->record_bar_width*$this->bar_width_adjust;

          if ($v < $this->x_axis_position) {
            $y1 = $this->ytr($this->x_axis_position);
            $y2 = $this->ytr($v);
          } else {
            $y1 = $this->ytr($v);
            $y2 = $this->ytr($this->x_axis_position);
          }

          if ($color_index >= count($this->ndx_data_color)) $color_index=0;
          if ($colbarcount >= count($this->ndx_data_border_color)) $colbarcount=0;
          $barcol = $this->ndx_data_color[$color_index];
          $bordercol = $this->ndx_data_border_color[$colbarcount];

          if ((strval($v) != "") ) {   //Allow for missing Y data
            if ($this->shading > 0) {
              for($i=0;$i<($this->shading);$i++) {
              //Shading set in SetDefaultColors
              ImageFilledRectangle($this->img, $x1+$i, $y1-$i, $x2+$i, $y2-$i, $this->ndx_i_light);
              }
            }

            ImageFilledRectangle($this->img, $x1, $y1, $x2, $y2, $barcol);
            ImageRectangle($this->img, $x1, $y1, $x2, $y2, $bordercol);
            if ($this->draw_data_labels == '1') {  //ajo
              $y1 = $this->ytr($this->label_scale_position * $v);
              //$this->DrawDataLabel($v,$j + .5,$v*$this->label_scale_position);
              $this->DrawText($this->small_font, $this->x_label_angle,
                $x1+$this->record_bar_width/2, $y1, $this->ndx_label_color, $this->x_label_ttffont_size, $v,'center','top');
            }
          }

          $color_index++;
          $colbarcount++;
        }
      }
    }
  }
580003
function drawHorizontalBars(layersSelection) {
            let layerJoin = layersSelection
                .data(layers);

            layerElements = layerJoin
                .enter()
                  .append('g')
                    .attr('transform', ({key}) => `translate(0,${yScale(key)})`)
                    .classed('layer', true);

            let barJoin = layerElements
                .selectAll('.bar')
                .data(({values}) => values);

            // Enter + Update
            let bars = barJoin
                    .enter()
                      .append('rect')
                        .classed('bar', true)
                        .attr('x', 1)
                        .attr('y', (d) => yScale2(getGroup(d)))
                        .attr('height', yScale2.bandwidth())
                        .attr('fill', (({group}) => categoryColorMap[group]));

            if (isAnimated) {
                bars.style('opacity', barOpacity)
                    .transition()
                    .delay((_, i) => animationDelays[i])
                    .duration(animationDuration)
                    .ease(ease)
                    .tween('attr.width', horizontalBarsTween);
            } else {
                bars.attr('width', (d) => xScale(getValue(d)));
            }
        }
737707
public function addBar($now = 0, $min = 0, $max = 100, $contextualClass = 'primary')
    {
        if ($now instanceof Bar) {
            $this->bars->push($now);
        } elseif (is_numeric($now)) {
            $bar = new Bar($now, $min, $max, $contextualClass);
            $this->bars->push($bar);
        }

        return $this;
    }
186500
function() {
			if(that.settings.cssClass !== null) {
				that.bar.addClass(that.settings.cssClass);
			}
		}
88770
def print_item_with_children(ac, classes, level):
    
    print_row(ac.id, ac.name, f"{ac.allocation:,.2f}", level)
    print_children_recursively(classes, ac, level + 1)
126395
def _bar(self, serie, parent, x, y, i, zero, secondary=False):
        """"""
        if serie.index % 2:
            y = -y
        return super(VerticalPyramid,
                     self)._bar(serie, parent, x, y, i, zero, secondary)
725275
def example6():
    """"""

    ray.init()

    cls = ray.remote(cyth.simple_class)
    a1 = cls.remote()
    a2 = cls.remote()

    result1 = ray.get(a1.increment.remote())
    result2 = ray.get(a2.increment.remote())

    print(result1, result2)
1227340
def _bar(self, serie, parent, x, y, i, zero, secondary=False):
        """"""
        if secondary:
            cumulation = (
                self.secondary_negative_cumulation
                if y < self.zero else self.secondary_positive_cumulation
            )
        else:
            cumulation = (
                self.negative_cumulation
                if y < self.zero else self.positive_cumulation
            )
        zero = cumulation[i]
        cumulation[i] = zero + y
        if zero == 0:
            zero = self.zero
            y -= self.zero
        y += zero

        width = (self.view.x(1) - self.view.x(0)) / self._len
        x, y = self.view((x, y))
        y = y or 0
        series_margin = width * self._series_margin
        x += series_margin
        width -= 2 * series_margin
        if self.secondary_series:
            width /= 2
            x += int(secondary) * width
            serie_margin = width * self._serie_margin
            x += serie_margin
            width -= 2 * serie_margin
        height = self.view.y(zero) - y
        r = serie.rounded_bars * 1 if serie.rounded_bars else 0
        self.svg.transposable_node(
            parent,
            'rect',
            x=x,
            y=y,
            rx=r,
            ry=r,
            width=width,
            height=height,
            class_='rect reactive tooltip-trigger'
        )
        return x, y, width, height
1368891
def _setup_bar(self):
        
        bar = u""
        items_cnt = len(PROGRESS_BAR_ITEMS)
        bar_val = float(self._time_left) / self._section_time * self.num_progress_bars
        while bar_val > 0:
            selector = int(bar_val * items_cnt)
            selector = min(selector, items_cnt - 1)
            bar += PROGRESS_BAR_ITEMS[selector]
            bar_val -= 1

        bar = bar.ljust(self.num_progress_bars)
        return bar
44853
private void addInteractiveExamples() {
		add(new WHeading(HeadingLevel.H2, "Simple WCheckBoxSelect examples"));
		addExampleUsingLookupTable();
		addExampleUsingArrayList();
		addExampleUsingStringArray();
		addInsideAFieldLayoutExamples();
		add(new WHeading(HeadingLevel.H2, "Examples showing LAYOUT properties"));
		addFlatSelectExample();
		addColumnSelectExample();
		addSingleColumnSelectExample();
		add(new WHeading(HeadingLevel.H2, "WCheckBoxSelect showing the frameless state"));
		add(new WHeading(HeadingLevel.H3, "Normal (with frame)"));
		WCheckBoxSelect select = new WCheckBoxSelect("australian_state");
		add(select);
		select.setToolTip("Make a selection");
		add(new WHeading(HeadingLevel.H3, "Without frame"));
		select = new WCheckBoxSelect("australian_state");
		add(select);
		select.setFrameless(true);
		select.setToolTip("Make a selection (no frame)");
	}