Graph Doesn't Render Properly in Chrome #660
-
I'm currently trying to create a graphic that visualizes the flow of a conversation between 2 people based on segment lengths. It looks like this when I open it in Preview and Safari: DESIRED However, it ends up looking like this when I open the pdf in chrome which is how most people will view it: CURRENT I've tried using line_height = 30
for segment in convo_segments:
utterance_length = (float(segment['end']) - float(segment['start']))
convo_length = convo_segments[-1]["end"]
width_of_segment = utterance_length / float(convo_length) * page_width
if segment['speaker'] == '0':
with pdf.new_path() as path:
path.style.stroke_color = '#ff8a5b'
path.style.stroke_width = width_of_segment
path.move_to(conversation_cursor, y_axis_starting_point)
path.vertical_line_relative(-line_height)
path.close()
else:
with pdf.new_path() as path:
path.style.stroke_color = '#083d77'
path.style.stroke_width = width_of_segment
path.move_to(conversation_cursor, y_axis_starting_point)
path.vertical_line_relative(line_height)
path.close()
conversation_cursor += width_of_segment
total_segments += width_of_segment and for segment in convo_segments:
...
if segment['speaker'] == '0':
pdf.set_draw_color(*salmon)
pdf.set_line_width(width_of_segment)
pdf.line(conversation_cursor, y_axis_starting_point, conversation_cursor, y_axis_starting_point - line_height)
else:
pdf.set_draw_color(*blue)
pdf.set_line_width(width_of_segment)
pdf.line(conversation_cursor, y_axis_starting_point, conversation_cursor, y_axis_starting_point + line_height)
... but they both give me the same output as shown in the screenshot above. Is there something wrong with my implementation or should I be approaching this problem in a different way altogether? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
Hi @platramos Thank you for the bug report. I'll try to have a look at this asap. Could you share some example value for |
Beta Was this translation helpful? Give feedback.
-
You can use rect() which will render correct in any browser. Adapt the following script to your needs (I just changed it quickly to see if it works):
I don't know why the other methods don't work. |
Beta Was this translation helpful? Give feedback.
You can use rect() which will render correct in any browser. Adapt the following script to your needs (I just changed it quickly to see if it works):