seolpyo-mplchart 1.4.1.1__py3-none-any.whl → 1.4.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of seolpyo-mplchart might be problematic. Click here for more details.

@@ -234,7 +234,7 @@ class CrossLineMixin(EventMixin):
234
234
 
235
235
  if self.in_price_chart or self.in_volume_chart:
236
236
  self._restore_region()
237
- self._draw_crossline(e, self.in_price_chart)
237
+ self._draw_crossline(e)
238
238
  self.figure.canvas.blit()
239
239
  else:
240
240
  if self._erase_crossline():
@@ -249,10 +249,10 @@ class CrossLineMixin(EventMixin):
249
249
  return True
250
250
  return False
251
251
 
252
- def _draw_crossline(self, e: MouseEvent, in_price_chart):
252
+ def _draw_crossline(self, e: MouseEvent):
253
253
  x, y = (e.xdata, e.ydata)
254
254
 
255
- if in_price_chart:
255
+ if self.in_price_chart:
256
256
  self.collection_price_crossline.set_segments([((x, self.price_ymin), (x, self.price_ymax)), ((self.vxmin, y), (self.vxmax, y))])
257
257
  self.collection_volume_crossline.set_segments([((x, 0), (x, self.volume_ymax))])
258
258
  else:
@@ -263,14 +263,14 @@ class CrossLineMixin(EventMixin):
263
263
  self.collection_price_crossline.draw(renderer)
264
264
  self.collection_volume_crossline.draw(renderer)
265
265
 
266
- self._draw_text_artist(e, in_price_chart)
266
+ self._draw_text_artist(e)
267
267
  return
268
268
 
269
- def _draw_text_artist(self, e: MouseEvent, in_price_chart):
269
+ def _draw_text_artist(self, e: MouseEvent):
270
270
  x, y = (e.xdata, e.ydata)
271
271
 
272
272
  renderer = self.figure.canvas.renderer
273
- if in_price_chart:
273
+ if self.in_price_chart:
274
274
  # 가격
275
275
  self.artist_text_price.set_text(f'{float_to_str(y, self.digit_price)}{self.unit_price}')
276
276
  self.artist_text_price.set_x(self.v0 if self.veighth < x else self.vsixth)
@@ -298,17 +298,20 @@ class CrossLineMixin(EventMixin):
298
298
 
299
299
 
300
300
  class BoxMixin(CrossLineMixin):
301
- def _draw_crossline(self, e, in_price_chart):
302
- super()._draw_crossline(e, in_price_chart)
303
- self._draw_box_artist(e, in_price_chart)
301
+ def _draw_crossline(self, e):
302
+ super()._draw_crossline(e)
303
+ self._draw_box_artist(e)
304
304
  return
305
305
 
306
- def _draw_box_artist(self, e: MouseEvent, in_price_chart):
306
+ def _draw_box_artist(self, e: MouseEvent):
307
307
  y = e.ydata
308
308
 
309
309
  renderer = self.figure.canvas.renderer
310
+
311
+ self.in_candle = False
312
+ self.in_volumebar = False
310
313
  if self.intx is not None:
311
- if in_price_chart:
314
+ if self.in_price_chart:
312
315
  # 박스 크기
313
316
  high = self.df['top_box_candle'][self.intx]
314
317
  low = self.df['bottom_box_candle'][self.intx]
@@ -318,21 +321,19 @@ class BoxMixin(CrossLineMixin):
318
321
  high, low = (high+sub, low-sub)
319
322
 
320
323
  # 커서가 캔들 사이에 있는지 확인
321
- if high < y or y < low: self.in_candle = False
322
- else:
324
+ if low <= y and y <= high:
323
325
  # 캔들 강조
324
326
  self.in_candle = True
325
327
  x1, x2 = (self.intx-0.3, self.intx+1.3)
326
328
  self.collection_price_box.set_segments([((x1, high), (x2, high), (x2, low), (x1, low), (x1, high))])
327
329
  self.collection_price_box.draw(renderer)
328
- elif self.volume:
330
+ elif self.in_volume_chart and self.volume:
329
331
  # 거래량 강조
330
332
  high = self.df['max_box_volume'][self.intx]
331
333
  low = 0
332
334
  if high < self.min_height_box_volume: high = self.min_height_box_volume
333
335
 
334
- if high < y or y < low: self.in_volumebar = False
335
- else:
336
+ if low <= y and y <= high:
336
337
  self.in_volumebar = True
337
338
  x1, x2 = (self.intx-0.3, self.intx+1.3)
338
339
  self.collection_volume_box.set_segments([((x1, high), (x2, high), (x2, low), (x1, low), (x1, high))])
@@ -395,8 +396,8 @@ class InfoMixin(BoxMixin):
395
396
  self._length_text = lenth_high if lenth_volume < lenth_high else lenth_volume
396
397
  return
397
398
 
398
- def _draw_box_artist(self, e, in_price_chart):
399
- super()._draw_box_artist(e, in_price_chart)
399
+ def _draw_box_artist(self, e):
400
+ super()._draw_box_artist(e)
400
401
 
401
402
  if self.intx is not None:
402
403
  if self.in_candle: self._draw_candle_info_artist(e)
seolpyo_mplchart/_draw.py CHANGED
@@ -251,11 +251,11 @@ class CandleSegmentMixin(DataMixin):
251
251
  tuple[tuple[float, float]]: candle segment
252
252
  """
253
253
  return (
254
- (x, high), (x, top),
254
+ (x, top),
255
255
  (left, top), (left, bottom),
256
256
  (x, bottom), (x, low), (x, bottom),
257
257
  (right, bottom), (right, top),
258
- (x, top), (x, high), (x, top),
258
+ (x, top), (x, high)
259
259
  )
260
260
 
261
261
  def _create_candle_segments(self):
@@ -411,9 +411,8 @@ class VolumeSegmentMixin(MaSegmentMixin):
411
411
  tuple[tuple[float, float]]: volume bar segment
412
412
  """
413
413
  return (
414
- (left, top), (left, 0),
415
- (right, 0), (right, top),
416
- (left, top), (left, 0),
414
+ (left, 0), (left, top),
415
+ (right, top), (right, 0),
417
416
  )
418
417
 
419
418
  def _create_volume_segments(self):
@@ -131,7 +131,9 @@ class CollectionMixin(PlotMixin):
131
131
  keys.append('x')
132
132
  keys.append(f'ma{i}')
133
133
 
134
- segment_slider = self.df[keys + ['x', self.close] ].values
134
+ series = self.df[keys + ['x', self.close]]
135
+ series['x'] = series['x'] - 0.5
136
+ segment_slider = series.values
135
137
  segment_slider = segment_slider.reshape(segment_slider.shape[0], len(self.list_ma)+1, 2).swapaxes(0, 1)
136
138
  self.collection_slider.set_segments(segment_slider)
137
139
  linewidth = [1 for _ in self.list_ma]
@@ -300,7 +302,7 @@ class MouseMoveMixin(BackgroundMixin):
300
302
  self.figure.canvas.blit()
301
303
  elif self.in_price_chart or self.in_volume_chart:
302
304
  self._restore_region()
303
- self._draw_crossline(e, self.in_price_chart)
305
+ self._draw_crossline(e)
304
306
  self.figure.canvas.blit()
305
307
  else:
306
308
  if self._erase_crossline():
@@ -376,10 +378,10 @@ class MouseMoveMixin(BackgroundMixin):
376
378
  self.artist_text_slider.draw(renderer)
377
379
  return
378
380
 
379
- def _draw_crossline(self, e: MouseEvent, in_price_chart):
381
+ def _draw_crossline(self, e: MouseEvent):
380
382
  self.collection_slider_vline.set_segments([((e.xdata, self.slider_ymin), (e.xdata, self.slider_ymax))])
381
383
  self.collection_slider_vline.draw(self.figure.canvas.renderer)
382
- return super()._draw_crossline(e, in_price_chart)
384
+ return super()._draw_crossline(e)
383
385
 
384
386
 
385
387
  class ClickMixin(MouseMoveMixin):
@@ -405,7 +407,7 @@ class ClickMixin(MouseMoveMixin):
405
407
 
406
408
  navleft, navright = self.navcoordinate
407
409
  x = e.xdata.__round__()
408
-
410
+
409
411
  leftmax = navleft + self._navLineWidth_half
410
412
  rightmin = navright - self._navLineWidth_half
411
413
 
@@ -565,7 +567,7 @@ class ChartClickMixin(ReleaseMixin):
565
567
  elif self.in_price_chart or self.in_volume_chart:
566
568
  self._restore_region(self.is_click_chart)
567
569
  if not self.is_click_chart:
568
- self._draw_crossline(e, self.in_price_chart)
570
+ self._draw_crossline(e)
569
571
  else: self._move_chart(e)
570
572
  self.figure.canvas.blit()
571
573
  else:
seolpyo_mplchart/test.py CHANGED
@@ -13,7 +13,7 @@ import seolpyo_mplchart as mc
13
13
  class Chart(mc.SliderChart):
14
14
  format_candleinfo = mc.format_candleinfo_ko + '\nCustom info: {ci}'
15
15
  format_volumeinfo = mc.format_volumeinfo_ko
16
- min_distance = 5
16
+ min_distance = 2
17
17
 
18
18
  def __init__(self, *args, **kwargs):
19
19
  super().__init__(*args, **kwargs)
@@ -29,27 +29,17 @@ class Chart(mc.SliderChart):
29
29
  def get_candle_segment(self, *, x, left, right, top, bottom, is_up, high, low):
30
30
  if is_up:
31
31
  return (
32
+ (x, top), (right, top), (x, top),
32
33
  (x, high),
33
- (x, top),
34
- (right, top),
35
- (x, top),
36
- (x, bottom),
37
- (left, bottom),
38
- (x, bottom),
39
34
  (x, low),
40
- (x, high)
35
+ (x, bottom), (left, bottom), (x, bottom),
41
36
  )
42
37
  else:
43
38
  return (
39
+ (x, bottom), (right, bottom), (x, bottom),
44
40
  (x, high),
45
- (x, bottom),
46
- (right, bottom),
47
- (x, bottom),
48
- (x, top),
49
- (left, top),
50
- (x, top),
51
41
  (x, low),
52
- (x, high)
42
+ (x, top), (left, top), (x, top),
53
43
  )
54
44
 
55
45
 
@@ -63,7 +53,7 @@ path_file = Path(__file__).parent / 'sample/samsung.txt'
63
53
 
64
54
  with open(path_file, 'r', encoding='utf-8') as txt:
65
55
  data = json.load(txt)
66
- df = pd.DataFrame(data[:20])
56
+ df = pd.DataFrame(data[:100])
67
57
 
68
58
  C.set_data(df)
69
59
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seolpyo-mplchart
3
- Version: 1.4.1.1
3
+ Version: 1.4.1.3
4
4
  Summary: Fast candlestick chart using Python. Includes navigator, slider, navigation, and text information display functions
5
5
  Author-email: white-seolpyo <white-seolpyo@naver.com>
6
6
  License: MIT License
@@ -50,8 +50,9 @@ Ethereum: 0x1c5fb8a5e0b1153cd4116c91736bd16fabf83520
50
50
  ## Korean format sample
51
51
  ![korean sample](https://raw.githubusercontent.com/white-seolpyo/seolpyo-mplchart/refs/heads/main/images/sample%20kor.png)
52
52
 
53
- ## change Candle shape sample
53
+ ## change Candle shape sample(draw Bar Chart)
54
54
  ![Candle shape sample](https://raw.githubusercontent.com/white-seolpyo/seolpyo-mplchart/refs/heads/main/images/change%20candle%20segment.png)
55
55
 
56
- # 40,000 data sample
56
+ # Mass Data Testing (40,000 Stock Price Data Points)
57
57
  ![40,000 sample](https://raw.githubusercontent.com/white-seolpyo/seolpyo-mplchart/refs/heads/main/images/40000.gif)
58
+
@@ -1,17 +1,17 @@
1
1
  seolpyo_mplchart/__init__.py,sha256=1rY6PP1OMMr1d_5x7dlAD2ImQAXChT5spvB45j6yDp8,18255
2
2
  seolpyo_mplchart/_base.py,sha256=3iG4AVwHR_h3rh6c1oJahWt7NvBpBFrS0bUZd4PaHfY,3921
3
- seolpyo_mplchart/_cursor.py,sha256=sQqMOkd8xgWMEs1RoUcAluiCQni680ri4WKCnzMiPHw,23515
4
- seolpyo_mplchart/_draw.py,sha256=W6nTcODv58ObNhWYCzF2gJad9_afFCE05svVPt3Xetk,23115
5
- seolpyo_mplchart/_slider.py,sha256=6GxxpAwDSTrqgr2dBpgU0sC6Xu5MAu5Hzpvrr9BKuuE,23374
3
+ seolpyo_mplchart/_cursor.py,sha256=v__66q2P4MdIsHjCZL_WcW2A-iFmXZaQMvOmbXvvkno,23370
4
+ seolpyo_mplchart/_draw.py,sha256=kD-FliRDDB7Jpfj_wbOtDs9bHla0oNr9_ksh5PXhUDI,23057
5
+ seolpyo_mplchart/_slider.py,sha256=Tuaz0_R9_U0oFqsGPzOZ1Gc2RnDiHdDP-gJrNyMFUBc,23357
6
6
  seolpyo_mplchart/base.py,sha256=0qdImsIMPzTTkkHzPv479BVe_ojrn45FidGE46eT5x4,3797
7
7
  seolpyo_mplchart/cursor.py,sha256=qq1WJJa7vCE5C2XeGBECt2XqxR_WxfybZZ5u6zVx5Ps,20415
8
8
  seolpyo_mplchart/draw.py,sha256=MiqDhbMJOSlWD6qdAghsyrZwCixcwm4nfmiinvwtt-o,21520
9
9
  seolpyo_mplchart/slider.py,sha256=-jZ6D23orDj3NmtnOviO1NRx4BrRxWvwTV5pzGQuWNI,22188
10
- seolpyo_mplchart/test.py,sha256=fUVC4kaoiKk2GDbQRT1ed1O9Diuvi1Yeucms7KtGhU4,1835
10
+ seolpyo_mplchart/test.py,sha256=hfqxvgffRxM7hZCNakpWGkzVdENMc31Nrmp4RpY05Lg,1646
11
11
  seolpyo_mplchart/utils.py,sha256=a3XycRBTndrsjBw_1VKTxbSvOGpVYXHRK87v7azgRe8,1433
12
12
  seolpyo_mplchart/data/apple.txt,sha256=0izAfweu1lLsC0IwVthdVlo9reG8KGbKGTSX5knI5Zc,1380864
13
13
  seolpyo_mplchart/data/samsung.txt,sha256=UejaSkbzr4E5K3lkelCT0yJiWUPfmViBEaTyoXyphIs,2476424
14
- seolpyo_mplchart-1.4.1.1.dist-info/METADATA,sha256=26Tk7uR7ILue3y3Nfs2MvHI24HbbJ4WpLWZrAb7-KqY,2678
15
- seolpyo_mplchart-1.4.1.1.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
16
- seolpyo_mplchart-1.4.1.1.dist-info/top_level.txt,sha256=KgqFn7rKWize7OjMaTCHxKm9ie6vqnyb5c8fN7y_tSo,17
17
- seolpyo_mplchart-1.4.1.1.dist-info/RECORD,,
14
+ seolpyo_mplchart-1.4.1.3.dist-info/METADATA,sha256=ytPqKuBmE7XSdhKLXat4HRGLp9PRPJfoI9qIgfymU3w,2728
15
+ seolpyo_mplchart-1.4.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ seolpyo_mplchart-1.4.1.3.dist-info/top_level.txt,sha256=KgqFn7rKWize7OjMaTCHxKm9ie6vqnyb5c8fN7y_tSo,17
17
+ seolpyo_mplchart-1.4.1.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5