Jump to content

PBR

Members
  • Posts

    33
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

PBR's Achievements

  1. Yes, my code is removing the row but exactly due to using IndexSet(), I get errors. Could you please share your script that I can see how to use RowId()? Thanks
  2. Thank you Gaia, I was doing a similar method in data functions, but I want to avoid creating a new column and keep the same column. That would affect the rest of my jobs doing on the table.
  3. Hello, I have a table that includes multiple columns in which one of the columns is named "ID" corresponds to the number of records. I also have a delete button to remove any selected rows from the table. However, the row number under "ID" is getting messed up if I delete a row in between. So, I was looking to update the numbers for "ID" column as I delete the rows. Here is my IronPython script but not sure exactly how to update that. from Spotfire.Dxp.Data import IndexSet, DataValueCursor dataTable = Document.Data.Tables["Events"] markings = Document.ActiveMarkingSelectionReference.GetSelection(dataTable) # Remove the selected rows dataTable.RemoveRows(markings) # Get reference to the 'ID' column idColumn = dataTable.Columns["ID"] idCursor = DataValueCursor.Create(idColumn) rowCounter = 1 # Create an IndexSet to cover all remaining rows after deletion remainingRows = IndexSet(dataTable.RowCount, True) # Update the ID in the remaining rows for rowIndex in range(dataTable.RowCount): if remainingRows.Contains(rowIndex): dataTable.SetValue(idCursor, rowIndex, rowCounter) rowCounter += 1 but I am getting this error: TypeError: expected IndexSet, got int I could update the numbers through a data function and introducing a new column but I am looking to do that through IronPython. Thank you
  4. I am wondering if I can concatenate a document property and a calculated column? I am looking to have the selected month and years on the category axis. for example, if I select the January from the list box, then I could have: January 2006, January 2007, ... on my category axis I cannot concatenate them by any ways: Display_Year :::::: If(([Month_String]="${Months}") and ([Year]>=2005) and ([Year]<=2025), Concatenate(${Months}, [Year]), NULL)
  5. Hi Jose, I tried method 2 and 3. I used method 2 when the zoom slider is on, and when I want to synch it manually. However, I am using markings as well as it is much simpler as you mentioned, and I can limit both graphs to that marking. Thank you
  6. Hello I have a dataset with columns: Time, Col1, Col2, and Col3 that is externally imported to Spotfire. I want to have a bar chart to show the average value of Col1-3 for the specific selected month through a listbox. I am using this expression for the category axis: <If(([Month_String]="${Months}") and ([Year]>=2005) and ([Year]<=2025), [Year], NULL) as [Year]> where Month_String is the calculated column to get the name of each month, ${Months} is a document property of string type, and Year is calculated column as integer. The y axis expression is: $map("Avg($esc(${SelectColListBox}))", ",") Where SelectColListBox is a document property to get the Col name. I am also using an expression to limit the data: ([Time]>=DocumentProperty("StartDate")) and ([Time]<=DocumentProperty("EndDate")) Everything is working well except that there is an extra bar on my chart that is named as "Empty" which shows the average of all values within other months. Any idea why the bar is there and how to remove that bar?
  7. Thank you Jose, Thank was exactly what I was looking for.
  8. Thank you Jose This an example of my problem. It is based on some fake data. I don's see the similar issue as I see in my real case, but still it is not working. I hope to understand the issue to extend it to my real case. Test_Sync_Zoomslider.dxp
  9. Thank you Jose for your reply. When I print rounded_low or rounded_high, it is showing the right numbers. But it still cannot implement the binned dates on x-axis. The second line chart is updating like below:
  10. Hi Gaia, Using the filter leads to a sudden shift in visualizing the data. However, using the zoom sliders provides a smoother zooming experience. I tried using the filter, but it makes it difficult to track the specific time we are looking for.
  11. Hello, I am trying to synchronize the zoom sliders of two line charts based on their X-axes, so that when the zoom on the first chart changes, the second chart updates accordingly. However, I’m facing an issue because the time format in the two charts is different. In the first chart, the time is read directly from a column [Time]. In the second chart, the time is based on binning with <BinByDateTime([Time],"Year.Quarter.Month.DayOfMonth.Hour",4)>, which shows hourly, monthly, quarterly, and yearly averages. I am trying to adjust the code below to synchronize the zoom to the hourly average on the second chart, and then plan to extend this to other bins as well. Any help or suggestions would be appreciated. Thank you! from Spotfire.Dxp.Application.Visuals import AxisRange, LineChart from System import DateTime def round(dt): minutes = dt.Minute if minutes >= 30: dt = dt.AddHours(1) return DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, 0, 0) # visA and visB are scripting parameters LineA = visA.As[LineChart]() LineB = visB.As[LineChart]() zoomAX = LineA.XAxis.ZoomRange # Round the start and end times to the nearest hour rounded_low = round(zoomAX.Low) rounded_high = round(zoomAX.High) axisRangeX = AxisRange(rounded_low, rounded_high) LineB.XAxis.ZoomRange = axisRangeX
  12. Thank you @Mathew Lee. I really appreciate the time and effort you put into preparing such a detailed response. I’ll try out the solution soon and will get back to you with my results.
×
×
  • Create New...