Giter Site home page Giter Site logo

Comments (3)

gphat avatar gphat commented on June 9, 2024

I'm confused. Are you saying that adding that line causes the tick labels to work?

from chart-clicker.

mguz avatar mguz commented on June 9, 2024

Yes, it is only this line. But I think it is not the final fix.
Under Windows every label consists of a β€˜β€™ ( empty string) in a line and the expected label-text in the next line.
The mentioned code line skips all empty lines and let only pass the lines with the label-text.
Therefore it produces the right output.

If I find time I will dig a little more in detail into the code. I think it is difficult for you, when you don’t use Windows.
Maybe it has something to do with issue #21. Also here is the y-axis label with spaces splitted in more lines (one line for every single word).

from chart-clicker.

mguz avatar mguz commented on June 9, 2024

After exploring the code, I got a little bit closer to the source of the problem.

A quick fix for this issue and issue #21 would be a comment sign:

return 0;

in the following code sequence

Graphics\Primitive\Driver\Cairo\TextLayout.pm in sub layout line 44:

    wrapper => Text::Flow::Wrap->new(
        check_width => sub {
            my $str = shift;
            my $r = $driver->get_text_bounding_box($comp, $str);
            unless($width) {
                # Catch the "no width" case.
                return 1;
            }
            if($r->width > $width) {
               print " get_text_bounding_box->width: ".$r->width."; width: $width; text: $str \n";  #!!d
               # return 0;
            }
            return 1;
        }

It disables the Text wrapper feature. But at the moment I don't see any advantage of this feature.
The supplementary line mentioned above is then no more necessary.

the print statement is only for debugging reason. The output of this statement is shown here:

get_text_bounding_box->width: 28; width: 26; text: 1.00
get_text_bounding_box->width: 28; width: 26; text: 3.20
get_text_bounding_box->width: 28; width: 26; text: 5.40
get_text_bounding_box->width: 28; width: 26; text: 7.60
get_text_bounding_box->width: 28; width: 26; text: 9.80
get_text_bounding_box->width: 35; width: 33; text: 12.00
get_text_bounding_box->width: 193; width: 191; text: Ipsum is a very long x-axis label [h]
get_text_bounding_box->width: 28; width: 26; text: 0.30
get_text_bounding_box->width: 28; width: 26; text: 1.40
get_text_bounding_box->width: 28; width: 26; text: 2.50
get_text_bounding_box->width: 28; width: 26; text: 3.60
get_text_bounding_box->width: 28; width: 26; text: 4.70
get_text_bounding_box->width: 28; width: 26; text: 5.80
get_text_bounding_box->width: 40; width: 20; text: Lorem
get_text_bounding_box->width: 65; width: 20; text: Lorem with
get_text_bounding_box->width: 97; width: 20; text: Lorem with more
get_text_bounding_box->width: 134; width: 20; text: Lorem with more words
get_text_bounding_box->width: 172; width: 20; text: Lorem with more words [W/m?]

Width is the component width:

my $width = $comp->width ? $comp->width : $comp->minimum_inside_width;

So the problem is that the component width is too small, mostly at the first check of
Text::Flow->wrapper->check_width
The output is therefore an empty string in the first line and the single words in the next lines.

This is the reason, why the labels are not plottet on Windows system and this is the reason
why longer y-axis labels with spaces are splitted in single words, which are plottet over each others (issue #21).

Attached ist the line-examples with longer labels:

linex

I don't know how the component width of the Textbox is set and how the layout-process is working. Therefore
I stopp at this point my debugging.

from chart-clicker.

Related Issues (20)

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.