Home forums Using CanvasJS Multiple charts per line in data grid

Tagged: , ,

This topic contains 1 reply, has 2 voices, and was last updated by  Priyanka M S 3 weeks, 5 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23165

    wonky
    Member

    In a PHP application, we are thinking to follow https://canvasjs.com/php-charts/chart-data-from-database/

    However, we have a stock list where each stock row/record should have 3 day, 7 day, 14 day charts, preferably sparklineish.

    I see from the example that each chart needs its own div, which we might be able to generate in a loop, except that the charts will be produced by multiple calls to the code, not one long running loop.

    There is an id field in the table in question so we an generate div ids like {id}{chart number in the row}, so 11,12,13,21,22,23, etc.

    Then the same chart, essentially, with a custom query, “Select period, close from tablename where stock- ‘XYZ’ and date(period) <= now()-duration, something like that…a non-trivial version of the example.

    The existing grid is a table, built by and the Chart fields are named like Chart7, Chart14, etc. There are some classes applied to each cell, like data-field=”Chart7”, but no Divs.

    So, in the custom PHP for each cell, we need to generate a div with a unique name like I wrote above, and create the chart per the example?

    Anyway….it seems a little complex. Is there any sample code for many charts per table?

    Thanks!

    #23185

    Priyanka M S
    Member

    @wonky,

    Please take a look at this sample project on rendering sparkline charts in table.

    __
    Priyanka M S
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.