Not possible to plot attribute with the id role

robert
robert New Altair Community Member
edited November 5 in Community Q&A
Trying to plot data such that the X axis is the date and the Y axis is the single_price, unfortunately the date cannot be selected.
The date properly appears in the metadata view and data view, but for some reason unknown to me, it does not display in plot view.
It would do no good to plot based on the row number, because I'd need the date. I could work around by duplicating the date field with Generate Attributes.
I tried Series and Scatter to no avail.
Here's the reduced process:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<process version="5.1.011">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="5.1.011" expanded="true" name="Process">
    <process expanded="true" height="444" width="1150">
      <operator activated="true" class="generate_sales_data" compatibility="5.1.011" expanded="true" height="60" name="Generate Sales Data" width="90" x="45" y="30"/>
      <operator activated="true" class="set_role" compatibility="5.1.011" expanded="true" height="76" name="Set Role" width="90" x="179" y="30">
        <parameter key="name" value="transaction_id"/>
        <list key="set_additional_roles"/>
      </operator>
      <operator activated="true" class="set_role" compatibility="5.1.011" expanded="true" height="76" name="Set Role (2)" width="90" x="447" y="30">
        <parameter key="name" value="date"/>
        <parameter key="target_role" value="id"/>
        <list key="set_additional_roles"/>
      </operator>
      <connect from_op="Generate Sales Data" from_port="output" to_op="Set Role" to_port="example set input"/>
      <connect from_op="Set Role" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/>
      <connect from_op="Set Role (2)" from_port="example set output" to_port="result 1"/>
      <portSpacing port="source_input 1" spacing="0"/>
      <portSpacing port="sink_result 1" spacing="162"/>
      <portSpacing port="sink_result 2" spacing="0"/>
    </process>
  </operator>
</process>
Tagged:

Answers

  • [Deleted User]
    [Deleted User] New Altair Community Member
    Hi,

    you simply have to leave the date as regular attribute. Then the plots work fine.

    Best,

    Edin
  • robert
    robert New Altair Community Member
    Thank you Edin, this worked; I just generated another attribute for the sole purpose of it being an id variable.