Giter Club home page Giter Club logo

php-colored-ascii-linechart's People

Contributors

lexustec avatar noximo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

php-colored-ascii-linechart's Issues

BUG with numbers between 0 and 1

CODE:

<?php

$chart = new Linechart();
echo $chart->addMarkers([0.1,0.9])->chart();

Output:

   0.2┤
  -0.6┤─

Expected Output:

something like this:

   0.9┤╭
   0.8┤│
   0.7┤│
   0.6┤│
   0.5┤│
   0.4┤│
   0.3┤│
   0.2┤│
   0.1┼╯

render error with unique values

If all values are the same the output is broken.

An example would be

$linechart = new Linechart();
echo $linechart->addMarkers([1,1,1])->chart();

I know this is an edge case, but I am using the graph to show temperature over time. If the temperature is not changing, the graph is broken and looks like this:

     1┤
  ───

it should render like this:

     1┤───

Somehow the line number calculated in \noximo\PHPColoredAsciiLinechart\Linechart::processLinearGraph (Line 417) is off by one. The result has two rows, even though there is only one line in the graph.

Setting the height is also not helping, it will reproduce the same:

$linechart = new Linechart();
$settings = new Settings();
$settings->setHeight(5);
echo $linechart->setSettings($settings)->addMarkers([1,1,1])->chart();

BUG with fixed header size

CODE:

<?php

$settings = new Settings();
$settings->setHeight(3);
$chart = new Linechart();
$chart->setSettings($settings);
echo $chart->addMarkers([1, 9])->chart();

Output:

  7.33┤
  4.67┤╭
     2┤│
 -0.67┤╯

Expected Output:

something like this:

     9┤╭
   5.5┤│
     1┼╯

setHeight accepts invalid values

would it make sense to prevent Settings::setHeight to accept invalid values?

public function setHeight(int $height): self
    {
        $this->height = $height;
        return $this;
    }

by changing it into
$this->height = max(1, $height);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.