GSMEthesis commited on
Commit
066c6cd
·
verified ·
1 Parent(s): 4e9e103

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -783,17 +783,18 @@ def enhanced_likert_scale(question_data):
783
  st.markdown(f"<div style='text-align:right; font-weight:bold; margin-bottom:15px; direction: rtl;'>{question}</div>",
784
  unsafe_allow_html=True)
785
 
786
- # نمایش برچسب‌ها با خطوط ارتباطی
787
  middle_label = ""
 
788
  if scale % 2 == 1: # اگر مقیاس فرد باشد
789
  middle_value = (scale // 2) + 1
790
  middle_label = f"""
791
  <div class='label-container middle-label' style='left: 50%; transform: translateX(-50%);'>
792
- <span>متوسط</span>
793
  </div>
794
  """
795
 
796
- # ایجاد ساختار HTML برای برچسب‌ها
797
  st.markdown(
798
  f"""
799
  <div class='labels-container'>
@@ -918,17 +919,21 @@ def enhanced_likert_scale(question_data):
918
  font-weight: bold;
919
  color: #6a0dad;
920
  text-align: center;
 
921
  }}
922
  .label-container span {{
923
  display: inline-block;
 
 
 
 
924
  }}
925
  /* خطوط ارتباطی */
926
  .left-label::before {{
927
  content: '';
928
  position: absolute;
929
  bottom: -30px;
930
- right: 50%;
931
- transform: translateX(50%);
932
  width: 2px;
933
  height: 25px;
934
  background-color: #6a0dad;
@@ -937,8 +942,7 @@ def enhanced_likert_scale(question_data):
937
  content: '';
938
  position: absolute;
939
  bottom: -30px;
940
- left: 50%;
941
- transform: translateX(-50%);
942
  width: 2px;
943
  height: 25px;
944
  background-color: #6a0dad;
 
783
  st.markdown(f"<div style='text-align:right; font-weight:bold; margin-bottom:15px; direction: rtl;'>{question}</div>",
784
  unsafe_allow_html=True)
785
 
786
+ # تنظیم لیبل وسط برای مقیاس‌های فرد
787
  middle_label = ""
788
+ middle_label_text = "متوسط" # لیبل پیش‌فرض برای وسط
789
  if scale % 2 == 1: # اگر مقیاس فرد باشد
790
  middle_value = (scale // 2) + 1
791
  middle_label = f"""
792
  <div class='label-container middle-label' style='left: 50%; transform: translateX(-50%);'>
793
+ <span>{middle_label_text}</span>
794
  </div>
795
  """
796
 
797
+ # نمایش برچسب‌ها با خطوط ارتباطی
798
  st.markdown(
799
  f"""
800
  <div class='labels-container'>
 
919
  font-weight: bold;
920
  color: #6a0dad;
921
  text-align: center;
922
+ flex: 1;
923
  }}
924
  .label-container span {{
925
  display: inline-block;
926
+ max-width: 150px; /* محدود کردن عرض لیبل‌ها برای جلوگیری از تداخل */
927
+ white-space: nowrap;
928
+ overflow: hidden;
929
+ text-overflow: ellipsis;
930
  }}
931
  /* خطوط ارتباطی */
932
  .left-label::before {{
933
  content: '';
934
  position: absolute;
935
  bottom: -30px;
936
+ right: 10%;
 
937
  width: 2px;
938
  height: 25px;
939
  background-color: #6a0dad;
 
942
  content: '';
943
  position: absolute;
944
  bottom: -30px;
945
+ left: 10%;
 
946
  width: 2px;
947
  height: 25px;
948
  background-color: #6a0dad;