Skip to content
Snippets Groups Projects

Download a chart as an image (CSV, PNG, JPEG)

Merged Mohammad Torkashvand requested to merge feature/COMP-247-download-charts-as-image into develop
8 unresolved threads

Merge request reports

Approval is optional

Merged by Mohammad TorkashvandMohammad Torkashvand 1 year ago (Aug 21, 2023 10:08am UTC)

Merge details

  • Changes merged into develop with ffeaffcb (commits were squashed).
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 import React, { useContext, ForwardRefExoticComponent, RefAttributes } from 'react';
2 import { ChartContainerContext } from '../../helpers/ChartContainerProvider';
3 import { Table, TableProps } from "react-bootstrap";
4
5 const OriginalTable: ForwardRefExoticComponent<TableProps & RefAttributes<HTMLTableElement>> = Table;
6
7 const ChartTable: React.FC<TableProps> = (props) => {
8 const tableContainerRef = useContext(ChartContainerContext);
9
10 return (
11 <div ref={tableContainerRef}>
12 <OriginalTable {...props} />
  • 46 47 data: BasicDataset
    47 48 }
    48 49
    49 function LineGraph({ data }: inputProps): ReactElement {
    50 return (
    51 <Line data={data} options={options} />
    52 );
    50 function LineGraph({data}: inputProps): ReactElement {
    51 const chartContainerRef = useContext(ChartContainerContext);
    52
    53 return (
    54 <div ref={chartContainerRef}>
  • 7 8 }
    8 9
    9 10 const WithLegend: React.FC<InputProps> = ({ children, location }) => {
    11 const chartContainerRef = useContext(ChartContainerContext);
    10 12
    11 13 if (!location) location = "both";
    12 14 const top = location === "top" || location === "both";
    13 15 const bottom = location === "bottom" || location === "both";
    14 16
    15 17 return (
    16 <>
    18 <div ref={chartContainerRef}>
  • 57 59 <DownloadDataButton data={chargingStructureData} filename="charging_mechanism_of_nrens_per_year.csv" exportType={ExportType.CSV}/>
    58 60 <DownloadDataButton data={chargingStructureData} filename="charging_mechanism_of_nrens_per_year.xlsx" exportType={ExportType.EXCEL} />
    59 61 </Row>
    60 <Table className="charging-struct-table" striped bordered responsive>
    62 <DownloadImageChartButton filename="charging_mechanism_of_nrens_per_year"/>
    63 <ChartTable className="charging-struct-table" striped bordered responsive>
  • 62 64 <DownloadDataButton data={projectData} filename="nren_involvement_in_european_commission_projects.csv" exportType={ExportType.CSV}/>
    63 65 <DownloadDataButton data={projectData} filename="nren_involvement_in_european_commission_projects.xlsx" exportType={ExportType.EXCEL}/>
    64 66 </Row>
    65 <Table borderless className='compendium-table'>
    67 <DownloadImageChartButton filename="nren_involvement_in_european_commission_projects"/>
    68 <ChartTable borderless className='compendium-table'>
  • 156 159 <DownloadDataButton data={fundingSourceData} filename="income_source_of_nren_per_year.csv" exportType={ExportType.CSV}/>
    157 160 <DownloadDataButton data={fundingSourceData} filename="income_source_of_nren_per_year.xlsx" exportType={ExportType.EXCEL}/>
    158 161 </Row>
    159 <div>
    162 <DownloadImageChartButton filename="income_source_of_nren_per_year"/>
    163 <div ref={chartRef}>
  • 56 58 <DownloadDataButton data={organisationData} filename="nren_parent_organisations.csv" exportType={ExportType.CSV}/>
    57 59 <DownloadDataButton data={organisationData} filename="nren_parent_organisations.xlsx" exportType={ExportType.EXCEL}/>
    58 60 </Row>
    59 <Table borderless className='compendium-table'>
    61 <DownloadImageChartButton filename='nren_parent_organisations'/>
    62 <ChartTable borderless className='compendium-table'>
  • 73 75 <tbody>
    74 76 {getJSXFromMap(organisationDataset)}
    75 77 </tbody>
    76 </Table>
    78 </ChartTable>
  • added 2 commits

    • bfdb4ecd - renamed TableWrapper to ChartContainer and maked it general
    • 9328fc30 - renamed TableWrapper to ChartContainer and maked it general

    Compare with previous version

  • added 1 commit

    • 25bcf066 - renamed TableWrapper to ChartContainer and maked it general

    Compare with previous version

  • added 1 commit

    • 65ce8e37 - renamed TableWrapper to ChartContainer and maked it general

    Compare with previous version

  • added 1 commit

    • 0a7b20d3 - renamed ChartTable to ChartContainer and made it general

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • mentioned in commit ffeaffcb

  • Please register or sign in to reply
    Loading