widgetti / widgetti/ipyvuetify

Sparklines minor issues.

Open
#65 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

add to examples
Dominant language
Python
Stars
355
Forks
61
PR merge metrics
No merged PRs in 30d

Description

Ipyvuetify sparklines are v nice for simple line plots.

Minor issues which I spotted (or couldn't work it out):

  1. Colours not working on the bar chart
  2. Rounded ends on line didn't seem to work

It doesn't matter too much. The main reason for creating this issue was to say Sparklines are really cool. Look at this demo. ............

sparklinesExample

import ipyvuetify as v 
import ipywidgets as widgets

y = [2,3,10,6,3,56,2,4,7]
x = [1,3,4,6,3,6 ,2,4,7]

spark = v.Sparkline(
      labels =x,
      value=y,
      gradient=['#f72047', '#ffd200', '#1feaea'],
      padding=10,
      line_width=5,
#       stroke_linecap="round", # round, lineCap   not in ipyvuetify??
      gradient_direction="top",  # top right left bottom
      fill=False,
      type="trend",  # trend, bar  # I cannot get colors on the bars
#       auto_line_width=False,
      auto_draw = True,  # animation
      show_labels=True,
      label_size=10,
      smooth = 10, # smoothline
    height = None,
    width = None
)

card = v.Card(width = 800, height= 800)

sliderCardWidth = v.Slider(v_model=10,min=0,max=2000,step=0.1,label="Card Width",thumb_label = True)
sliderCardHeight = v.Slider(v_model=10,min=0,max=2000,step=0.1,label="Card Height",thumb_label = True)
widgets.jslink((card,'width'),(sliderCardWidth,'v_model'))
widgets.jslink((card,'height'),(sliderCardHeight,'v_model'))


sliderWidth = v.Slider(v_model=10,min=0,max=1000,step=0.1,label="Sparkline figure Width",thumb_label = True)
sliderHeight = v.Slider(v_model=10,min=0,max=500,step=0.1,label="Sparkline figure Height",thumb_label = True)
sliderLineWidth = v.Slider(v_model=10,min=0,max=20,step=0.1,label="Line Width",thumb_label = True)
sliderLabelSize = v.Slider(v_model=10,min=0,max=20,step=0.1,label="Label Size",thumb_label = True)
sliderSmooth = v.Slider(v_model=10,min=0,max=50,step=0.1,label="Smoothing",thumb_label = True)
sliderPadding = v.Slider(v_model=10,min=0,max=50,step=0.1,label="Padding",thumb_label = True)
switchLabels = v.Switch( v_model=True, label="Show labels doesn't work?",disabled=False)
switchFill = v.Switch( v_model=False, label="Fill?",disabled=False)
switchType = v.Switch( v_model=False, label="Fill?",disabled=False)

widgets.jslink((spark,'width'),(sliderWidth,'v_model'))
widgets.jslink((spark,'height'),(sliderHeight,'v_model'))
widgets.jslink((spark,'line_width'),(sliderLineWidth,'v_model'))
widgets.jslink((spark,'label_size'),(sliderLabelSize,'v_model'))
widgets.jslink((spark,'smooth'),(sliderSmooth,'v_model'))
widgets.jslink((spark,'padding'),(sliderPadding,'v_model'))
widgets.jslink((spark,'fill'),(switchFill,'v_model'))
widgets.jslink((spark,'show_labels'),(switchLabels,'v_model'))


col = v.Col(children=[ sliderWidth,sliderHeight,spark,sliderLineWidth,sliderLabelSize,sliderSmooth,sliderPadding,switchLabels,switchFill])
card.children = [col]
colCardTop = v.Col(children=[sliderCardWidth, sliderCardHeight,card])
colCardTop

import numpy as np
import time
num=0
while num<20:
    num+=1
    time.sleep(0.3)
    spark.value = list(np.array(y)*np.random.random(len(y)))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two reported behaviors with the v.Sparkline example in the issue: bar-chart colors and rounded line ends. Trace the Sparkline component and its exposed options, then verify that both settings work in the provided Jupyter example.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, python
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.