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

How to plot a simple model field #98

Open
ramiboutas opened this issue Dec 13, 2023 · 2 comments
Open

How to plot a simple model field #98

ramiboutas opened this issue Dec 13, 2023 · 2 comments

Comments

@ramiboutas
Copy link

How to plot a simple model field using chartjs?

I have the folllowing model:

class RoomValue(models.Model):
    time = models.DateTimeField(auto_now_add=True)
    temperature = models.FloatField()
    humility = models.FloatField()
    light = models.FloatField()

I would like just to plot time vs temperature. How can I do that?

I tried the following:

class RoomTemperatures(ReportView):
    report_model = RoomValue
    date_field = "time"
    chart_engine = "chartsjs"

    chart_settings = [
        Chart(
            "Room temperature",
            Chart.LINE,
            data_source=["temperature"],
            title_source=["time"],
            plot_total=True,
        ),
    ]

Thank you very much!

@ramiboutas
Copy link
Author

I am trying to use this package in my site:

https://ramiboutas.com/stats/

@RamezIssac
Copy link
Owner

Hello @ramiboutas 👋
I just want to acknowledge the receipt...
I will get back to you soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants