Giter VIP home page Giter VIP logo

prawn-graph's People

Contributors

raikun85 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

Watchers

 avatar

prawn-graph's Issues

Notes about Prawn 1.0 roadmap

Hello!

Thanks for building an extension to Prawn. I'm filing this issue to let you know that we're currently working towards a stable 1.0 release of Prawn, and I want to invite you to be part of the discussion around that.

We will only have one more major release before 1.0 is shipped: it will be labeled 0.15 and it will be cut on 2014-02-16.

The functionality of the 0.15 release will be largely the same as what we ship in 1.0, so if you want to test your project against the newest Prawn code, that would be a good time to
do it. You can also get a head start by trying out what is on master now, and reporting any problems you encounter.

If your project is sufficiently up to date and is able to run on the latest Prawn code, the next step would be to take a look at our API compatibility plans, which are described in detail here:

https://groups.google.com/forum/#!topic/prawn-ruby/dbTSnlDhED0

Here's the very quick summary:

  • If your project is using stable APIs and ONLY stable APIs, it will be safe for you to lock your Prawn dependency to "~> 1.0".
  • If your project is using stable and extension APIs, keep an eye out for deprecation warnings, and lock your gem to
    a range of known good minor Prawn versions. (i.e. ">= 1.0", "<=1.x"). We want to eventually apply semantic versioning to our extension API as well, but we're not there yet.
  • The use of experimental APIs in your extensions is not recommended unless you consider your own code to be experimental as well. Instead, work with us to figure out what it would take to get these experimental APIs stabilized or extracted.

I know this is a little bit confusing, and my hope is that in the not too distant future we'll be able to cut a Prawn 2.0 release that has much better support for downstream dependencies.

Until that time, what we lack in stability we'll try to make up in support for your project. Use the Prawn mailing list to contact us about any concerns or breakage, help us work on API stabilization, and let us know when you need extension points to support your project.

Thanks!
-greg

Pie Charts ETA

Hi,

When do you expect to have Pie Chart support? This is something I am really looking forward to.

Thanks,
Jay

Unhelpful error message and lack of documentation

Using the default theme lets you have no more than 5 series because only five colours are assigned in the theme. This should be made clear in the documentation - if you want to have more than five series you need to define the colours in a theme.

This problem is compounded by the fact that when you try to have more series than colours defined the error message is unknown color space: '' As a new user I installed the gem, didn't touch themes or change any defaults, tried to plot a graph with 6 series and got this error. Without context this was very confusing.

I think the graph function should check if the number of colours in the theme is not enough for the number of series and, if not, raise an error with a message like this: You are trying to plot a graph with #{series_count} series but only #{colour_count} colours in the theme.

Are other graph functionalities available?

Are there basic graph functionalities like gridlines, resizing, removing the DOTS in a line chart etc? I cannot see them in the documentation so I doubt if such features are available. I am used to using DYGRAPHS charting library and would like to know if some of similar customization features are available. I really need gridlines and some basic functionalities for modifying how the graph looks. Please let me know if it is possbile. I appreciate the developer's effort though. Thanks!

Rotating xlabels by some degree

I am generating a PDF using gem prawn. I have also added one bar graph but I want to rotate xlabels by 90 degree. Is there some way to do it using prawn-graph?

And how to have uniform yaxis_labels? Right now it just puts up some numbers based on the data points you have provided.

Graph spacing is a bit off

The spacing between bars and their position on the grid is rather sloppy and tends to render un-usable graphs for small record-sets.

Documentation contradicts itself

README.md has this under Removed Features

Unlike previous versions of prawn-graph, this version does not at this time include a theme api or the ability to change the colors used to render the graph.

Which is then contradicted further down the page under Theming

You can pass an instnace [sic] of Prawn::Graph::Theme using the :theme option to the graph and chart methods.

It looks like one of these statements overrides the other, but I can't see which is still valid.

Y-axis values are not displaying properly

my Y-axis values are 6 digit numbers but graph is displaying max 4 digits.
Also Values are overriding in Y-axis.

Is there any way to fix this ?
I am using
rails 6.1.6
ruby 2.6.7
prawn-graph 1.0.6

Screenshot from 2023 08 11 12 31 22

Multiple graphs in same pdf document overlay one another

Using prawn with prawn-graph,

pdf.graph(series....
pdf.move_down(4)
pdf.graph(series2...

Creates two graphs that overlay one another...the titles and labels are printed on top of each other. Expecting to see two separate graphs here.

Screen Shot 2023-10-19 at 12 04 56 PM

Y-Axis line extension for negative values

It seems like the Y-axis doesn't seem to extend for negative y-values. The graph seems to be perfect however, to enhance the readability, I'd like to visibly extend the y axis below the origin. Is it possible as of now? I have attached a demo in the file below:
email_monitor.pdf

Y axis not displaying correctly

Hi, first of all thanks for making this gem!
I tried out your example:

require 'prawn-graph'

  series = []
  series << Prawn::Graph::Series.new([4,9,3,2,1,6,2,8,2,3,4,9,2],  title: "A label for a series", type: :bar)
  series << Prawn::Graph::Series.new([5,4,3,2,7,9,2,8,7,5,4,9,2],  title: "Another label", type: :line, mark_average: true, mark_minimum: true)
  series << Prawn::Graph::Series.new([1,2,3,4,5,9,6,4,5,6,3,2,11], title: "Yet another label", type: :bar)
  series << Prawn::Graph::Series.new([1,2,3,4,5,12,6,4,5,6,3,2,9].shuffle, title: "One final label", type: :line, mark_average: true, mark_maximum: true)

  xaxis_labels = ['0900', '1000', '1100', '1200', '1300', '1400', '1500', '1600', '1700', '1800', '1900', '2000', '2100']

  Prawn::Document.generate('test.pdf') do
    graph series, width: 500, height: 200, title: "A Title for the chart", at: [10,700], xaxis_labels: xaxis_labels
  end

When displaying it, it shows the y-axis with the values 12,9,12,9,12,9,11,12 instead of the correct values. Is this a dependency issue, any other way to set the Y axis manually?

Thanks,
Regards,
Dirk

Create a new "Canvas" base upon which Prawn::Graph::Series will be drawn

This new Canvas will represent the area of a document which the chart / graph will be rendered - including any titles, labels, axes, grids, etc, etc - it will essentially be an updated version of the old Prawn::Graph::Legacy::Grid, but with support for multiple series and a more logical (and testable) interface for orchestrating the rendering of each series.

This will make use of the sizing code introduced from prawn-svg since it already does a great job of making sure SVG objects can be scaled to fit in the available space.

Small issues preventing Ruby 1.9 compatibility

Array#nitems is defunct as of Ruby 1.9. Using it in prawn/graph/base.rb (line 213) and prawn/graph/theme.rb (line 103) prevents basic functionality under Ruby 1.9. Array#count can be used instead and works with Ruby 1.8.7.

Re-introduce themes support

It should be possible to specify colours for series in prawn graph in a similar way to how the old "themes" support worked.

The default should remain the current greyscale colours, but we should be able to specify the colours for:

  • Series
  • Axis Lines
  • Title
  • Legend Text
  • Average Line
  • Max indicator
  • Min Indicator

Line chart not starting on the line

I am trying to build a line chart, but I noticed the first value is starting below the x-axis line. I am digging into the code now but would want to open an issue as well.

Example:

series = []
series << Prawn::Graph::Series.new([0,1.47,3.86,6.43,14.65,20.6,20.86,32.71,32.75,42.39,42.46,61.24,67.97,72.68,73.63,74.66,100.84,104.79,107.1,163.33,163.4,164.28,165.12,168.83,171.07,177.95,257.09,260.65,263.99,323.11,342.15,349.9,469.93,472.72,485.84,495.87,540.92,541.37,543,552.52,555.18,556.17,556.5,561.86,563.28,573.98,716.51,716.51,747.39,754.75,758.15,761.65,770.59,826.77,829.64,830.83,846.15,869.96,877.63,879.64,890.91,898.77,899.42,949,953.43,966.25,966.98,1070.1,1103.1,1105.75,1184.08,1193.34,1197.4,1206.86,1217.94,1244.72,1246.85,1256.11,1294.97,1298.91,1320.07,1591.88,1594.09,1601.54,1615.34,1625.54,1643.13,1649.04,1667.93,1676.61,1697.22,1712.25,1744.68,1751.56,1798.26,1888.64,1901.28,1908.82,1994.79,2021.5,2033.58,2078.22,2079.55,2093.98,2097.76], type: :bar)
series << Prawn::Graph::Series.new([0,1.47,3.86,6.43,14.65,20.6,20.86,32.71,32.75,42.39,42.46,61.24,67.97,72.68,73.63,74.66,100.84,104.79,107.1,163.33,163.4,164.28,165.12,168.83,171.07,177.95,257.09,260.65,263.99,323.11,342.15,349.9,469.93,472.72,485.84,495.87,540.92,541.37,543,552.52,555.18,556.17,556.5,561.86,563.28,573.98,716.51,716.51,747.39,754.75,758.15,761.65,770.59,826.77,829.64,830.83,846.15,869.96,877.63,879.64,890.91,898.77,899.42,949,953.43,966.25,966.98,1070.1,1103.1,1105.75,1184.08,1193.34,1197.4,1206.86,1217.94,1244.72,1246.85,1256.11,1294.97,1298.91,1320.07,1591.88,1594.09,1601.54,1615.34,1625.54,1643.13,1649.04,1667.93,1676.61,1697.22,1712.25,1744.68,1751.56,1798.26,1888.64,1901.28,1908.82,1994.79,2021.5,2033.58,2078.22,2079.55,2093.98,2097.76], type: :line)

graph series, { width: bounds.width, height: 200, title: "Historical Profit/Loss ARG", :series_key => false, at: [0,bounds.height] }

For the example, I used both a line and bar of the same values to show that it is incorrectly rendering both line and bar charts.

This example produces this output:
brian_pdf__1_page_

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.