Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference line and area components aren't reactive #1928

Closed
HopeFan opened this issue Apr 22, 2024 · 2 comments · Fixed by #1959
Closed

Reference line and area components aren't reactive #1928

HopeFan opened this issue Apr 22, 2024 · 2 comments · Fixed by #1959
Labels
bug Something isn't working

Comments

@HopeFan
Copy link

HopeFan commented Apr 22, 2024

Steps To Reproduce

1. create queries inside queries folder :

monthly_tech_overtime.sql

SELECT *
FROM insights.monthly_tech_ovt_tbl
WHERE PC = 'OT'

monthly_stat_count.sql

WITH monthly_summary_stats AS (
    SELECT 
        QUANTILE_DISC(total_count, 0.75) as percentile_75,
        QUANTILE_DISC(total_count, 0.25) as percentile_25,
        QUANTILE_DISC(total_hours, 0.25) as hpercentile_25,
        QUANTILE_DISC(total_hours, 0.75) as hpercentile_75,
        MAX(total_count) as max_total_count,
        MAX(total_hours) as max_total_hours,
        COUNT(DISTINCT employid) as employee,
    FROM ${monthly_tech_overtime}
)
SELECT 
    (percentile_75 + 1.5 * (percentile_75 - percentile_25)) as outlier,
    (hpercentile_75 + 1.5 * (hpercentile_75 - hpercentile_25)) as houtlier,
    max_total_count,
    max_total_hours,
    employee
FROM monthly_summary_stats

2. create a page called like overtime_tech.sql

inside the page add this:

queries:  
- monthly_tech_overtime: technician_overtime/monthly_tech_overtime.sql  
- monthly_stat_count: technician_overtime/monthly_stat_count.sql

<Grid cols=3 gapSize="sm">
  <Dropdown name=year_of_dropdown title="Select Year">
    <DropdownOption valueLabel="2024" value=2024 />
    <DropdownOption valueLabel="2023" value=2023 />
  </Dropdown>
  <Dropdown name=season_of_dropdown title="Select Seasonality">
    <DropdownOption valueLabel="Monthly" value="Monthly" />
    <DropdownOption valueLabel="Weekly" value="Weekly" />
  </Dropdown>  
  <Dropdown name=division_of_dropdown  title="Select Maintenance Division">
    <DropdownOption valueLabel="VIC" value="VIC" />
    <DropdownOption valueLabel="NSW" value="NSW" />
    <DropdownOption valueLabel="OLD" value="QLD" />
    <DropdownOption valueLabel="SA" value="SA" />
    <DropdownOption valueLabel="WA" value="WA" />
    <DropdownOption valueLabel="NT" value="NT" />
    <DropdownOption valueLabel="TAS" value="TAS" />
    <DropdownOption valueLabel="ACT" value="ACT" />
  </Dropdown>
</Grid>

  <Histogram
    data={monthly_tech_overtime}
    x=Total_count
    yAxisTitle="Number of Observed Technicians"
    xAxisTitle="Technician Overtime Instances"
    yGridlines=false
    colorPalette={['#01bcff','#010320']}
   title=""
   chartAreaHeight=250
  >
    <ReferenceLine x={monthly_stat_count[0].outlier} label="Threshold" color=black labelColor=black lineWidth=2/>
    <ReferenceArea xMin={monthly_stat_count[0].outlier}  xMax={monthly_stat_count[0].max_total_count+10} 
    label="Unusual Overtime" color='#eeeeee' labelPosition=center labelColor=black />
  </Histogram>

Environment

  • Node version (node -v): v18.18.0
  • npm version (npm -v): 9.8.1
  • OS: Windows
  • Browser: Chrome
  • Database: duckdb

Expected Behavior

I think expected behavour is that when we change anything like year and the refrence line and annotation area values changed, we should see the last change in the chart not having same on top of each other. ( please refer to the screenshots I shared with you)

Actual Behaviour

in the dropdown list when I change for example a dropdown list from year 2024 to 2023 , I ended up having both in one chart :
image (1)
image

Workarounds

Anything you can do in advance of this being fixed?
not sure but let me know if you have any questions .

@HopeFan HopeFan added bug Something isn't working to-review Evidence team to review labels Apr 22, 2024
@HopeFan
Copy link
Author

HopeFan commented Apr 22, 2024

@mcrascal mcrascal removed the to-review Evidence team to review label Apr 22, 2024
@mcrascal mcrascal changed the title Reference line and area component Reference line and area components aren't reactive Apr 22, 2024
@hughess
Copy link
Member

hughess commented May 2, 2024

@HopeFan how does the query get updated by the dropdown? I don't see the inputs showing up in any of your queries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants